├── .gitignore ├── LICENSE ├── README.md ├── backup-mongodb.sh ├── brokers ├── README.md ├── Template.csv └── conversionScripts.md ├── captain-definition ├── codemirror-graphql ├── LICENSE ├── README.md ├── cm6-legacy │ ├── mode.d.ts │ ├── mode.d.ts.map │ ├── mode.esm.js │ ├── mode.js │ └── mode.js.map ├── esm │ ├── cm6-legacy │ │ ├── mode.d.ts │ │ ├── mode.d.ts.map │ │ ├── mode.js │ │ └── mode.js.map │ ├── hint.d.ts │ ├── hint.d.ts.map │ ├── hint.js │ ├── hint.js.map │ ├── info.d.ts │ ├── info.d.ts.map │ ├── info.js │ ├── info.js.map │ ├── jump.d.ts │ ├── jump.d.ts.map │ ├── jump.js │ ├── jump.js.map │ ├── lint.d.ts │ ├── lint.d.ts.map │ ├── lint.js │ ├── lint.js.map │ ├── mode.d.ts │ ├── mode.d.ts.map │ ├── mode.js │ ├── mode.js.map │ ├── results │ │ ├── mode.d.ts │ │ ├── mode.d.ts.map │ │ ├── mode.js │ │ └── mode.js.map │ ├── utils │ │ ├── SchemaReference.d.ts │ │ ├── SchemaReference.d.ts.map │ │ ├── SchemaReference.js │ │ ├── SchemaReference.js.map │ │ ├── collectVariables.d.ts │ │ ├── collectVariables.d.ts.map │ │ ├── collectVariables.js │ │ ├── collectVariables.js.map │ │ ├── forEachState.d.ts │ │ ├── forEachState.d.ts.map │ │ ├── forEachState.js │ │ ├── forEachState.js.map │ │ ├── getTypeInfo.d.ts │ │ ├── getTypeInfo.d.ts.map │ │ ├── getTypeInfo.js │ │ ├── getTypeInfo.js.map │ │ ├── hintList.d.ts │ │ ├── hintList.d.ts.map │ │ ├── hintList.js │ │ ├── hintList.js.map │ │ ├── info-addon.d.ts │ │ ├── info-addon.d.ts.map │ │ ├── info-addon.js │ │ ├── info-addon.js.map │ │ ├── jsonParse.d.ts │ │ ├── jsonParse.d.ts.map │ │ ├── jsonParse.js │ │ ├── jsonParse.js.map │ │ ├── jump-addon.d.ts │ │ ├── jump-addon.d.ts.map │ │ ├── jump-addon.js │ │ ├── jump-addon.js.map │ │ ├── mode-factory.d.ts │ │ ├── mode-factory.d.ts.map │ │ ├── mode-factory.js │ │ ├── mode-factory.js.map │ │ ├── mode-indent.d.ts │ │ ├── mode-indent.d.ts.map │ │ ├── mode-indent.js │ │ ├── mode-indent.js.map │ │ ├── runParser.d.ts │ │ ├── runParser.d.ts.map │ │ ├── runParser.js │ │ └── runParser.js.map │ └── variables │ │ ├── hint.d.ts │ │ ├── hint.d.ts.map │ │ ├── hint.js │ │ ├── hint.js.map │ │ ├── lint.d.ts │ │ ├── lint.d.ts.map │ │ ├── lint.js │ │ ├── lint.js.map │ │ ├── mode.d.ts │ │ ├── mode.d.ts.map │ │ ├── mode.js │ │ └── mode.js.map ├── hint.d.ts ├── hint.d.ts.map ├── hint.esm.js ├── hint.js ├── hint.js.map ├── info.d.ts ├── info.d.ts.map ├── info.esm.js ├── info.js ├── info.js.map ├── jump.d.ts ├── jump.d.ts.map ├── jump.esm.js ├── jump.js ├── jump.js.map ├── lint.d.ts ├── lint.d.ts.map ├── lint.esm.js ├── lint.js ├── lint.js.map ├── mode.d.ts ├── mode.d.ts.map ├── mode.esm.js ├── mode.js ├── mode.js.map ├── package.json ├── results │ ├── mode.d.ts │ ├── mode.d.ts.map │ ├── mode.esm.js │ ├── mode.js │ └── mode.js.map ├── src │ ├── __tests__ │ │ ├── hint-test.ts │ │ ├── kitchen-sink.graphql │ │ ├── lint-test.ts │ │ ├── mode-test.ts │ │ ├── schema-kitchen-sink.graphql │ │ └── testSchema.ts │ ├── cm6-legacy │ │ └── mode.ts │ ├── hint.ts │ ├── index.d.ts │ ├── info.ts │ ├── jump.ts │ ├── lint.ts │ ├── mode.ts │ ├── results │ │ ├── __tests__ │ │ │ └── mode-test.ts │ │ └── mode.ts │ ├── utils │ │ ├── SchemaReference.ts │ │ ├── __tests__ │ │ │ └── jsonParse-test.ts │ │ ├── collectVariables.ts │ │ ├── forEachState.ts │ │ ├── getTypeInfo.ts │ │ ├── hintList.ts │ │ ├── info-addon.ts │ │ ├── jsonParse.ts │ │ ├── jump-addon.ts │ │ ├── mode-factory.ts │ │ ├── mode-indent.ts │ │ └── runParser.ts │ └── variables │ │ ├── __tests__ │ │ ├── hint-test.ts │ │ ├── lint-test.ts │ │ └── mode-test.ts │ │ ├── hint.ts │ │ ├── lint.ts │ │ └── mode.ts ├── utils │ ├── SchemaReference.d.ts │ ├── SchemaReference.d.ts.map │ ├── SchemaReference.esm.js │ ├── SchemaReference.js │ ├── SchemaReference.js.map │ ├── collectVariables.d.ts │ ├── collectVariables.d.ts.map │ ├── collectVariables.esm.js │ ├── collectVariables.js │ ├── collectVariables.js.map │ ├── forEachState.d.ts │ ├── forEachState.d.ts.map │ ├── forEachState.esm.js │ ├── forEachState.js │ ├── forEachState.js.map │ ├── getTypeInfo.d.ts │ ├── getTypeInfo.d.ts.map │ ├── getTypeInfo.esm.js │ ├── getTypeInfo.js │ ├── getTypeInfo.js.map │ ├── hintList.d.ts │ ├── hintList.d.ts.map │ ├── hintList.esm.js │ ├── hintList.js │ ├── hintList.js.map │ ├── info-addon.d.ts │ ├── info-addon.d.ts.map │ ├── info-addon.esm.js │ ├── info-addon.js │ ├── info-addon.js.map │ ├── jsonParse.d.ts │ ├── jsonParse.d.ts.map │ ├── jsonParse.esm.js │ ├── jsonParse.js │ ├── jsonParse.js.map │ ├── jump-addon.d.ts │ ├── jump-addon.d.ts.map │ ├── jump-addon.esm.js │ ├── jump-addon.js │ ├── jump-addon.js.map │ ├── mode-factory.d.ts │ ├── mode-factory.d.ts.map │ ├── mode-factory.esm.js │ ├── mode-factory.js │ ├── mode-factory.js.map │ ├── mode-indent.d.ts │ ├── mode-indent.d.ts.map │ ├── mode-indent.esm.js │ ├── mode-indent.js │ ├── mode-indent.js.map │ ├── runParser.d.ts │ ├── runParser.d.ts.map │ ├── runParser.esm.js │ ├── runParser.js │ └── runParser.js.map └── variables │ ├── hint.d.ts │ ├── hint.d.ts.map │ ├── hint.esm.js │ ├── hint.js │ ├── hint.js.map │ ├── lint.d.ts │ ├── lint.d.ts.map │ ├── lint.esm.js │ ├── lint.js │ ├── lint.js.map │ ├── mode.d.ts │ ├── mode.d.ts.map │ ├── mode.esm.js │ ├── mode.js │ └── mode.js.map ├── docker-compose-local.yml ├── docker-compose.yml ├── docker ├── .dockerignore └── Dockerfile ├── index.html ├── index.mjs ├── package-lock.json ├── package.json ├── requiredClasses.json ├── src ├── App.vue ├── assets │ ├── astronaut.png │ ├── base.css │ ├── logo.svg │ ├── main.css │ ├── style-dark.css │ └── sun_full_blue.png ├── components │ ├── Calendar.vue │ ├── Filters.vue │ ├── LoginRegister.vue │ ├── Nav.vue │ ├── NoData.vue │ ├── ReturnToTopButton.vue │ ├── Screenshot.vue │ ├── SideMenu.vue │ ├── SpinnerLoadingPage.vue │ └── icons │ │ ├── IconCommunity.vue │ │ ├── IconDocumentation.vue │ │ ├── IconEcosystem.vue │ │ ├── IconSupport.vue │ │ └── IconTooling.vue ├── layouts │ ├── Dashboard.vue │ └── LoginRegister.vue ├── main.js ├── router │ └── index.js ├── stores │ ├── counter.js │ └── globals.js ├── utils │ ├── addTrades.js │ ├── brokers.js │ ├── calendar.js │ ├── charts.js │ ├── daily.js │ ├── diary.js │ ├── filters.js │ ├── playbooks.js │ ├── screenshots.js │ ├── trades.js │ └── utils.js └── views │ ├── AddDiary.vue │ ├── AddExcursions.vue │ ├── AddPlaybook.vue │ ├── AddScreenshot.vue │ ├── AddTrades.vue │ ├── Calendar.vue │ ├── Checkout.vue │ ├── CheckoutSuccess.vue │ ├── Daily.vue │ ├── Dashboard.vue │ ├── Diary.vue │ ├── Imports.vue │ ├── Login.vue │ ├── Playbook.vue │ ├── Register.vue │ ├── Screenshots.vue │ └── Settings.vue └── vite.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | vendor 3 | node_modules 4 | .DS_Store 5 | dist 6 | .vscode 7 | logs 8 | .idea/ 9 | -------------------------------------------------------------------------------- /backup-mongodb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Variables 4 | DATABASE_USER="$1" 5 | DATABASE_PASSWORD="$2" 6 | MONGO_HOST="$3" 7 | MONGO_PORT="$4" 8 | MONGO_DATABASE="$5" 9 | S3_BUCKET_NAME="$6" 10 | S3_BUCKET_PATH="$7" 11 | MONGO_DATABASE_NAME="$8" 12 | MONGODUMP_PATH="/usr/bin/mongodump" 13 | TIMESTAMP=`date +%F_%H%M` 14 | 15 | # Force file syncronization and lock writes 16 | echo -e "\n 1- LOCKING DATABASE" 17 | mongosh --authenticationDatabase admin -u $DATABASE_USER -p $DATABASE_PASSWORD --eval "printjson(db.fsyncLock())" 18 | 19 | # Create backup 20 | echo -e "\n 2- CREATING BACKUP..." 21 | $MONGODUMP_PATH -h $MONGO_HOST:$MONGO_PORT -d $MONGO_DATABASE --authenticationDatabase admin -u $DATABASE_USER -p $DATABASE_PASSWORD 22 | 23 | # mv dump to current folder (tmp) and add timestamp to backup 24 | echo -e "\n 3- MOVING BACKUP TO CURRENT FOLDER" 25 | mv dump $TIMESTAMP-$MONGO_DATABASE_NAME 26 | tar cf $TIMESTAMP-$MONGO_DATABASE_NAME.tar $TIMESTAMP-$MONGO_DATABASE_NAME 27 | 28 | # Upload to S3 29 | echo -e "\n 4- UPLOADING TO S3" 30 | s3cmd -c /root/.s3cfg put $TIMESTAMP-$MONGO_DATABASE_NAME.tar s3://$S3_BUCKET_NAME/$S3_BUCKET_PATH/$TIMESTAMP/$TIMESTAMP-$MONGO_DATABASE_NAME.tar 31 | 32 | # Remove dumps and dump tars in current folder 33 | echo -e "\n 5- REMOVING BACKUP FROM CURRENT FOLDER" 34 | rm -r $TIMESTAMP-$MONGO_DATABASE_NAME $TIMESTAMP-$MONGO_DATABASE_NAME.tar 35 | 36 | # Unlock databases writes 37 | echo -e "\n 6- UNLOCKING DATABASE" 38 | mongosh --authenticationDatabase admin -u $DATABASE_USER -p $DATABASE_PASSWORD --eval "printjson(db.fsyncUnlock())" 39 | 40 | echo -e "\n DONE" 41 | -------------------------------------------------------------------------------- /brokers/Template.csv: -------------------------------------------------------------------------------- 1 | Account,T/D,S/D,Currency,Type,Side,Symbol,Qty,Price,Exec Time,Comm,SEC,TAF,NSCC,Nasdaq,ECN Remove,ECN Add,Gross Proceeds,Net Proceeds,Clr Broker,Liq,Note 2 | XY000001,08/08/2022,08/10/2022,USD,stock,SS,RBLX,50,49.88,09:47:59,0,0.06,0.01,0,0,0,0,2494,2493.93,SIM,, 3 | XY000001,08/08/2022,08/10/2022,USD,stock,BC,RBLX,25,49.65,09:48:22,0,0,0,0,0,0,0,-1241.25,-1241.25,SIM,, 4 | XY000001,08/08/2022,08/10/2022,USD,stock,BC,RBLX,25,49.89,09:48:45,0,0,0,0,0,0,0,-1247.25,-1247.25,SIM,, 5 | XY000001,08/08/2022,08/10/2022,USD,stock,SS,RBLX,100,50.5,10:01:17,0,0.12,0.02,0,0,0,0,5050,5049.86,SIM,, 6 | XY000001,08/08/2022,08/10/2022,USD,stock,BC,RBLX,100,50.72,10:02:14,0,0,0,0,0,0,0,-5072,-5072,SIM,, 7 | XY000001,08/08/2022,08/10/2022,USD,stock,SS,RBLX,100,50.74,10:03:01,0,0.12,0.02,0,0,0,0,5074,5073.86,SIM,, 8 | XY000001,08/08/2022,08/10/2022,USD,stock,BC,RBLX,50,50.53,10:04:21,0,0,0,0,0,0,0,-2526.5,-2526.5,SIM,, 9 | XY000001,08/08/2022,08/10/2022,USD,stock,BC,RBLX,50,50.74,10:05:41,0,0,0,0,0,0,0,-2537,-2537,SIM,, 10 | XY000001,08/08/2022,08/10/2022,USD,stock,SS,SQ,100,90.93,10:25:15,0,0.21,0.02,0,0,0,0,9093,9092.77,SIM,, 11 | XY000001,08/08/2022,08/10/2022,USD,stock,BC,SQ,50,90.67,10:25:45,0,0,0,0,0,0,0,-4533.5,-4533.5,SIM,, 12 | XY000001,08/08/2022,08/10/2022,USD,stock,BC,SQ,25,90.31,10:27:11,0,0,0,0,0,0,0,-2257.75,-2257.75,SIM,, 13 | XY000001,08/08/2022,08/10/2022,USD,stock,BC,SQ,13,90,10:27:18,0,0,0,0,0,0,0,-1170,-1170,SIM,, 14 | XY000001,08/08/2022,08/10/2022,USD,stock,BC,SQ,12,89.9,10:27:25,0,0,0,0,0,0,0,-1078.8,-1078.8,SIM,, 15 | XY000001,08/08/2022,08/10/2022,USD,stock,B,SQ,50,82.07,10:09:21,0,0,0,0,0,0,0,-4103.5,-4103.5,SIM,, 16 | XY000001,08/08/2022,08/10/2022,USD,stock,S,SQ,50,81.82,10:09:51,0,0.1,0.01,0,0,0,0,4091,4090.89,SIM,, -------------------------------------------------------------------------------- /captain-definition: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 2, 3 | "dockerfilePath" :"docker/Dockerfile" 4 | } -------------------------------------------------------------------------------- /codemirror-graphql/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 GraphQL Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /codemirror-graphql/cm6-legacy/mode.d.ts: -------------------------------------------------------------------------------- 1 | import type { StreamParser } from '@codemirror/language'; 2 | export declare const graphql: StreamParser; 3 | //# sourceMappingURL=mode.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/cm6-legacy/mode.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode.d.ts","sourceRoot":"","sources":["../src/cm6-legacy/mode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKzD,eAAO,MAAM,OAAO,mBAAyD,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/cm6-legacy/mode.esm.js: -------------------------------------------------------------------------------- 1 | import graphqlModeFactory from '../utils/mode-factory'; 2 | export const graphql = graphqlModeFactory({}); 3 | //# sourceMappingURL=mode.js.map -------------------------------------------------------------------------------- /codemirror-graphql/cm6-legacy/mode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __importDefault = (this && this.__importDefault) || function (mod) { 3 | return (mod && mod.__esModule) ? mod : { "default": mod }; 4 | }; 5 | Object.defineProperty(exports, "__esModule", { value: true }); 6 | exports.graphql = void 0; 7 | var mode_factory_1 = __importDefault(require("../utils/mode-factory")); 8 | exports.graphql = (0, mode_factory_1.default)({}); 9 | //# sourceMappingURL=mode.js.map -------------------------------------------------------------------------------- /codemirror-graphql/cm6-legacy/mode.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode.js","sourceRoot":"","sources":["../src/cm6-legacy/mode.ts"],"names":[],"mappings":";;;;;;AACA,uEAAuD;AAI1C,QAAA,OAAO,GAAG,IAAA,sBAAkB,EAAC,EAAE,CAAiC,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/cm6-legacy/mode.d.ts: -------------------------------------------------------------------------------- 1 | import type { StreamParser } from '@codemirror/language'; 2 | export declare const graphql: StreamParser; 3 | //# sourceMappingURL=mode.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/cm6-legacy/mode.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode.d.ts","sourceRoot":"","sources":["../../src/cm6-legacy/mode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKzD,eAAO,MAAM,OAAO,mBAAyD,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/cm6-legacy/mode.js: -------------------------------------------------------------------------------- 1 | import graphqlModeFactory from '../utils/mode-factory'; 2 | export const graphql = graphqlModeFactory({}); 3 | //# sourceMappingURL=mode.js.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/cm6-legacy/mode.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode.js","sourceRoot":"","sources":["../../src/cm6-legacy/mode.ts"],"names":[],"mappings":"AACA,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AAIvD,MAAM,CAAC,MAAM,OAAO,GAAG,kBAAkB,CAAC,EAAE,CAAiC,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/hint.d.ts: -------------------------------------------------------------------------------- 1 | import CodeMirror, { Hints, Hint } from 'codemirror'; 2 | import 'codemirror/addon/hint/show-hint'; 3 | import { FragmentDefinitionNode, GraphQLSchema, GraphQLType } from 'graphql'; 4 | import type { Maybe } from 'graphql-language-service'; 5 | export interface GraphQLHintOptions { 6 | schema?: GraphQLSchema; 7 | externalFragments?: string | FragmentDefinitionNode[]; 8 | } 9 | interface IHint extends Hint { 10 | isDeprecated?: boolean; 11 | type?: Maybe; 12 | description?: Maybe; 13 | deprecationReason?: Maybe; 14 | } 15 | interface IHints extends Hints { 16 | list: IHint[]; 17 | } 18 | declare module 'codemirror' { 19 | interface ShowHintOptions { 20 | schema?: GraphQLSchema; 21 | externalFragments?: string | FragmentDefinitionNode[]; 22 | } 23 | interface CodeMirrorHintMap { 24 | graphql: (editor: CodeMirror.Editor, options: GraphQLHintOptions) => IHints | undefined; 25 | } 26 | } 27 | export type { IHint, IHints }; 28 | //# sourceMappingURL=hint.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/hint.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"hint.d.ts","sourceRoot":"","sources":["../src/hint.ts"],"names":[],"mappings":"AAWA,OAAO,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,iCAAiC,CAAC;AAEzC,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAGtD,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,GAAG,sBAAsB,EAAE,CAAC;CACvD;AAED,UAAU,KAAM,SAAQ,IAAI;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,iBAAiB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACnC;AAED,UAAU,MAAO,SAAQ,KAAK;IAC5B,IAAI,EAAE,KAAK,EAAE,CAAC;CACf;AAED,OAAO,QAAQ,YAAY,CAAC;IAC1B,UAAU,eAAe;QACvB,MAAM,CAAC,EAAE,aAAa,CAAC;QACvB,iBAAiB,CAAC,EAAE,MAAM,GAAG,sBAAsB,EAAE,CAAC;KACvD;IAED,UAAU,iBAAiB;QACzB,OAAO,EAAE,CACP,MAAM,EAAE,UAAU,CAAC,MAAM,EACzB,OAAO,EAAE,kBAAkB,KACxB,MAAM,GAAG,SAAS,CAAC;KACzB;CACF;AAuED,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/hint.js: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | import 'codemirror/addon/hint/show-hint'; 3 | import { getAutocompleteSuggestions, Position } from 'graphql-language-service'; 4 | CodeMirror.registerHelper('hint', 'graphql', (editor, options) => { 5 | const { schema, externalFragments } = options; 6 | if (!schema) { 7 | return; 8 | } 9 | const cur = editor.getCursor(); 10 | const token = editor.getTokenAt(cur); 11 | const tokenStart = token.type !== null && /"|\w/.test(token.string[0]) 12 | ? token.start 13 | : token.end; 14 | const position = new Position(cur.line, tokenStart); 15 | const rawResults = getAutocompleteSuggestions(schema, editor.getValue(), position, token, externalFragments); 16 | const results = { 17 | list: rawResults.map(item => ({ 18 | text: item.label, 19 | type: item.type, 20 | description: item.documentation, 21 | isDeprecated: item.isDeprecated, 22 | deprecationReason: item.deprecationReason, 23 | })), 24 | from: { line: cur.line, ch: tokenStart }, 25 | to: { line: cur.line, ch: token.end }, 26 | }; 27 | if ((results === null || results === void 0 ? void 0 : results.list) && results.list.length > 0) { 28 | results.from = CodeMirror.Pos(results.from.line, results.from.ch); 29 | results.to = CodeMirror.Pos(results.to.line, results.to.ch); 30 | CodeMirror.signal(editor, 'hasCompletion', editor, results, token); 31 | } 32 | return results; 33 | }); 34 | //# sourceMappingURL=hint.js.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/hint.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"hint.js","sourceRoot":"","sources":["../src/hint.ts"],"names":[],"mappings":"AAWA,OAAO,UAA2B,MAAM,YAAY,CAAC;AACrD,OAAO,iCAAiC,CAAC;AAIzC,OAAO,EAAE,0BAA0B,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAiDhF,UAAU,CAAC,cAAc,CACvB,MAAM,EACN,SAAS,EACT,CACE,MAAyB,EACzB,OAA2B,EACP,EAAE;IACtB,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC;IAC9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AAG,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClE,OAAO,CAAC,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAC5D,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;KACpE;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CACF,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/info.d.ts: -------------------------------------------------------------------------------- 1 | import { GraphQLSchema } from 'graphql'; 2 | import { SchemaReference } from './utils/SchemaReference'; 3 | import './utils/info-addon'; 4 | import type { Maybe } from 'graphql-language-service'; 5 | export interface GraphQLInfoOptions { 6 | schema?: GraphQLSchema; 7 | onClick?: Maybe<(ref: Maybe, e: MouseEvent) => void>; 8 | renderDescription?: (str: string) => string; 9 | render?: () => string; 10 | } 11 | //# sourceMappingURL=info.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/info.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../src/info.ts"],"names":[],"mappings":"AAUA,OAAO,EAQL,aAAa,EAEd,MAAM,SAAS,CAAC;AAIjB,OAAO,EAML,eAAe,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEtD,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC,CAAC;IACtE,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5C,MAAM,CAAC,EAAE,MAAM,MAAM,CAAC;CACvB"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/jump.d.ts: -------------------------------------------------------------------------------- 1 | import './utils/jump-addon'; 2 | import { GraphQLSchema } from 'graphql'; 3 | import type { State } from 'graphql-language-service'; 4 | export interface GraphQLJumpOptions { 5 | schema?: GraphQLSchema; 6 | onClick?: () => void; 7 | state?: State; 8 | } 9 | //# sourceMappingURL=jump.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/jump.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"jump.d.ts","sourceRoot":"","sources":["../src/jump.ts"],"names":[],"mappings":"AAsBA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEtD,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/jump.js: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | import getTypeInfo from './utils/getTypeInfo'; 3 | import { getArgumentReference, getDirectiveReference, getEnumValueReference, getFieldReference, getTypeReference, } from './utils/SchemaReference'; 4 | import './utils/jump-addon'; 5 | CodeMirror.registerHelper('jump', 'graphql', (token, options) => { 6 | if (!options.schema || !options.onClick || !token.state) { 7 | return; 8 | } 9 | const { state } = token; 10 | const { kind, step } = state; 11 | const typeInfo = getTypeInfo(options.schema, state); 12 | if ((kind === 'Field' && step === 0 && typeInfo.fieldDef) || 13 | (kind === 'AliasedField' && step === 2 && typeInfo.fieldDef)) { 14 | return getFieldReference(typeInfo); 15 | } 16 | if (kind === 'Directive' && step === 1 && typeInfo.directiveDef) { 17 | return getDirectiveReference(typeInfo); 18 | } 19 | if (kind === 'Argument' && step === 0 && typeInfo.argDef) { 20 | return getArgumentReference(typeInfo); 21 | } 22 | if (kind === 'EnumValue' && typeInfo.enumValue) { 23 | return getEnumValueReference(typeInfo); 24 | } 25 | if (kind === 'NamedType' && typeInfo.type) { 26 | return getTypeReference(typeInfo); 27 | } 28 | }); 29 | //# sourceMappingURL=jump.js.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/jump.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"jump.js","sourceRoot":"","sources":["../src/jump.ts"],"names":[],"mappings":"AAYA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,oBAAoB,CAAC;AAsB5B,UAAU,CAAC,cAAc,CACvB,MAAM,EACN,SAAS,EACT,CAAC,KAAuB,EAAE,OAA2B,EAAE,EAAE;IACvD,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;QACvD,OAAO;KACR;IAKD,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACxB,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAC7B,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAEpD,IACE,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC;QACrD,CAAC,IAAI,KAAK,cAAc,IAAI,IAAI,KAAK,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,EAC5D;QACA,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAC;KACpC;IACD,IAAI,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,CAAC,IAAI,QAAQ,CAAC,YAAY,EAAE;QAC/D,OAAO,qBAAqB,CAAC,QAAQ,CAAC,CAAC;KACxC;IACD,IAAI,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,CAAC,IAAI,QAAQ,CAAC,MAAM,EAAE;QACxD,OAAO,oBAAoB,CAAC,QAAQ,CAAC,CAAC;KACvC;IACD,IAAI,IAAI,KAAK,WAAW,IAAI,QAAQ,CAAC,SAAS,EAAE;QAC9C,OAAO,qBAAqB,CAAC,QAAQ,CAAC,CAAC;KACxC;IACD,IAAI,IAAI,KAAK,WAAW,IAAI,QAAQ,CAAC,IAAI,EAAE;QACzC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,CAAC;KACnC;AACH,CAAC,CACF,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/lint.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=lint.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/lint.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../src/lint.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /codemirror-graphql/esm/lint.js: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | import { getDiagnostics } from 'graphql-language-service'; 3 | const SEVERITY = ['error', 'warning', 'information', 'hint']; 4 | const TYPE = { 5 | 'GraphQL: Validation': 'validation', 6 | 'GraphQL: Deprecation': 'deprecation', 7 | 'GraphQL: Syntax': 'syntax', 8 | }; 9 | CodeMirror.registerHelper('lint', 'graphql', (text, options) => { 10 | const { schema, validationRules, externalFragments } = options; 11 | const rawResults = getDiagnostics(text, schema, validationRules, undefined, externalFragments); 12 | const results = rawResults.map(error => ({ 13 | message: error.message, 14 | severity: error.severity ? SEVERITY[error.severity - 1] : SEVERITY[0], 15 | type: error.source ? TYPE[error.source] : undefined, 16 | from: CodeMirror.Pos(error.range.start.line, error.range.start.character), 17 | to: CodeMirror.Pos(error.range.end.line, error.range.end.character), 18 | })); 19 | return results; 20 | }); 21 | //# sourceMappingURL=lint.js.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/lint.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"lint.js","sourceRoot":"","sources":["../src/lint.ts"],"names":[],"mappings":"AASA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;AAC7D,MAAM,IAAI,GAA2B;IACnC,qBAAqB,EAAE,YAAY;IACnC,sBAAsB,EAAE,aAAa;IACrC,iBAAiB,EAAE,QAAQ;CAC5B,CAAC;AAsBF,UAAU,CAAC,cAAc,CACvB,MAAM,EACN,SAAS,EACT,CAAC,IAAY,EAAE,OAA2B,EAA2B,EAAE;IACrE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC;IAC/D,MAAM,UAAU,GAAG,cAAc,CAC/B,IAAI,EACJ,MAAM,EACN,eAAe,EACf,SAAS,EACT,iBAAiB,CAClB,CAAC;IAEF,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACvC,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;QACnD,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC;QACzE,EAAE,EAAE,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC;KACpE,CAAC,CAAC,CAAC;IAEJ,OAAO,OAAO,CAAC;AACjB,CAAC,CACF,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/mode.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=mode.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/mode.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode.d.ts","sourceRoot":"","sources":["../src/mode.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /codemirror-graphql/esm/mode.js: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | import modeFactory from './utils/mode-factory'; 3 | CodeMirror.defineMode('graphql', modeFactory); 4 | //# sourceMappingURL=mode.js.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/mode.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode.js","sourceRoot":"","sources":["../src/mode.ts"],"names":[],"mappings":"AASA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,WAAW,MAAM,sBAAsB,CAAC;AAE/C,UAAU,CAAC,UAAU,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/results/mode.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=mode.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/results/mode.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode.d.ts","sourceRoot":"","sources":["../../src/results/mode.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /codemirror-graphql/esm/results/mode.js: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | import { list, t, onlineParser, p } from 'graphql-language-service'; 3 | import indent from '../utils/mode-indent'; 4 | CodeMirror.defineMode('graphql-results', config => { 5 | const parser = onlineParser({ 6 | eatWhitespace: stream => stream.eatSpace(), 7 | lexRules: LexRules, 8 | parseRules: ParseRules, 9 | editorConfig: { tabSize: config.tabSize }, 10 | }); 11 | return { 12 | config, 13 | startState: parser.startState, 14 | token: parser.token, 15 | indent, 16 | electricInput: /^\s*[}\]]/, 17 | fold: 'brace', 18 | closeBrackets: { 19 | pairs: '[]{}""', 20 | explode: '[]{}', 21 | }, 22 | }; 23 | }); 24 | const LexRules = { 25 | Punctuation: /^\[|]|\{|\}|:|,/, 26 | Number: /^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/, 27 | String: /^"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?/, 28 | Keyword: /^true|false|null/, 29 | }; 30 | const ParseRules = { 31 | Document: [p('{'), list('Entry', p(',')), p('}')], 32 | Entry: [t('String', 'def'), p(':'), 'Value'], 33 | Value(token) { 34 | switch (token.kind) { 35 | case 'Number': 36 | return 'NumberValue'; 37 | case 'String': 38 | return 'StringValue'; 39 | case 'Punctuation': 40 | switch (token.value) { 41 | case '[': 42 | return 'ListValue'; 43 | case '{': 44 | return 'ObjectValue'; 45 | } 46 | return null; 47 | case 'Keyword': 48 | switch (token.value) { 49 | case 'true': 50 | case 'false': 51 | return 'BooleanValue'; 52 | case 'null': 53 | return 'NullValue'; 54 | } 55 | return null; 56 | } 57 | }, 58 | NumberValue: [t('Number', 'number')], 59 | StringValue: [t('String', 'string')], 60 | BooleanValue: [t('Keyword', 'builtin')], 61 | NullValue: [t('Keyword', 'keyword')], 62 | ListValue: [p('['), list('Value', p(',')), p(']')], 63 | ObjectValue: [p('{'), list('ObjectField', p(',')), p('}')], 64 | ObjectField: [t('String', 'property'), p(':'), 'Value'], 65 | }; 66 | //# sourceMappingURL=mode.js.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/results/mode.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode.js","sourceRoot":"","sources":["../../src/results/mode.ts"],"names":[],"mappings":"AASA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAS,MAAM,0BAA0B,CAAC;AAC3E,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAM1C,UAAU,CAAC,UAAU,CAAC,iBAAiB,EAAE,MAAM,CAAC,EAAE;IAChD,MAAM,MAAM,GAAG,YAAY,CAAC;QAC1B,aAAa,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE;QAC1C,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE,UAAU;QACtB,YAAY,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE;KAC1C,CAAC,CAAC;IAEH,OAAO;QACL,MAAM;QACN,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,KAAK,EAAE,MAAM,CAAC,KAAiD;QAC/D,MAAM;QACN,aAAa,EAAE,WAAW;QAC1B,IAAI,EAAE,OAAO;QACb,aAAa,EAAE;YACb,KAAK,EAAE,QAAQ;YACf,OAAO,EAAE,MAAM;SAChB;KACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAKH,MAAM,QAAQ,GAAG;IAEf,WAAW,EAAE,iBAAiB;IAG9B,MAAM,EAAE,2DAA2D;IAGnE,MAAM,EAAE,yDAAyD;IAGjE,OAAO,EAAE,kBAAkB;CAC5B,CAAC;AAKF,MAAM,UAAU,GAAG;IACjB,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAA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EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACxD,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/SchemaReference.d.ts: -------------------------------------------------------------------------------- 1 | import { GraphQLSchema } from 'graphql'; 2 | import type { GraphQLArgument, GraphQLDirective, GraphQLEnumValue, GraphQLEnumType, GraphQLField, GraphQLNamedType } from 'graphql'; 3 | import { Maybe } from 'graphql/jsutils/Maybe'; 4 | import { TypeInfo } from './getTypeInfo'; 5 | export declare type SchemaReference = FieldReference | DirectiveReference | ArgumentReference | EnumValueReference | TypeReference; 6 | export declare type FieldReference = { 7 | kind: 'Field'; 8 | field: GraphQLField; 9 | type: Maybe; 10 | schema?: GraphQLSchema; 11 | }; 12 | export declare type DirectiveReference = { 13 | kind: 'Directive'; 14 | directive: GraphQLDirective; 15 | schema?: GraphQLSchema; 16 | }; 17 | export declare type ArgumentReference = { 18 | kind: 'Argument'; 19 | argument: GraphQLArgument; 20 | field?: GraphQLField; 21 | type?: GraphQLNamedType; 22 | directive?: GraphQLDirective; 23 | schema?: GraphQLSchema; 24 | }; 25 | export declare type EnumValueReference = { 26 | kind: 'EnumValue'; 27 | value?: GraphQLEnumValue; 28 | type?: GraphQLEnumType; 29 | schema?: GraphQLSchema; 30 | }; 31 | export declare type TypeReference = { 32 | kind: 'Type'; 33 | type: GraphQLNamedType; 34 | schema?: GraphQLSchema; 35 | }; 36 | export declare function getFieldReference(typeInfo: any): FieldReference; 37 | export declare function getDirectiveReference(typeInfo: any): DirectiveReference; 38 | export declare function getArgumentReference(typeInfo: any): ArgumentReference; 39 | export declare function getEnumValueReference(typeInfo: TypeInfo): EnumValueReference; 40 | export declare function getTypeReference(typeInfo: any, type?: Maybe): TypeReference; 41 | //# sourceMappingURL=SchemaReference.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/SchemaReference.d.ts.map: -------------------------------------------------------------------------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,CAAC,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,oBAAY,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,GAAG,GAAG,cAAc,CAO/D;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,GAAG,GAAG,kBAAkB,CAMvE;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,GAAG,GAAG,iBAAiB,CAerE;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,kBAAkB,CAS5E;AAID,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,GAAG,EACb,IAAI,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAC7B,aAAa,CAMf"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/SchemaReference.js: -------------------------------------------------------------------------------- 1 | import { getNamedType } from 'graphql'; 2 | export function getFieldReference(typeInfo) { 3 | return { 4 | kind: 'Field', 5 | schema: typeInfo.schema, 6 | field: typeInfo.fieldDef, 7 | type: isMetaField(typeInfo.fieldDef) ? null : typeInfo.parentType, 8 | }; 9 | } 10 | export function getDirectiveReference(typeInfo) { 11 | return { 12 | kind: 'Directive', 13 | schema: typeInfo.schema, 14 | directive: typeInfo.directiveDef, 15 | }; 16 | } 17 | export function getArgumentReference(typeInfo) { 18 | return typeInfo.directiveDef 19 | ? { 20 | kind: 'Argument', 21 | schema: typeInfo.schema, 22 | argument: typeInfo.argDef, 23 | directive: typeInfo.directiveDef, 24 | } 25 | : { 26 | kind: 'Argument', 27 | schema: typeInfo.schema, 28 | argument: typeInfo.argDef, 29 | field: typeInfo.fieldDef, 30 | type: isMetaField(typeInfo.fieldDef) ? null : typeInfo.parentType, 31 | }; 32 | } 33 | export function getEnumValueReference(typeInfo) { 34 | return { 35 | kind: 'EnumValue', 36 | value: typeInfo.enumValue || undefined, 37 | type: typeInfo.inputType 38 | ? getNamedType(typeInfo.inputType) 39 | : undefined, 40 | }; 41 | } 42 | export function getTypeReference(typeInfo, type) { 43 | return { 44 | kind: 'Type', 45 | schema: typeInfo.schema, 46 | type: type || typeInfo.type, 47 | }; 48 | } 49 | function isMetaField(fieldDef) { 50 | return fieldDef.name.slice(0, 2) === '__'; 51 | } 52 | //# sourceMappingURL=SchemaReference.js.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/SchemaReference.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"SchemaReference.js","sourceRoot":"","sources":["../../src/utils/SchemaReference.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAiB,MAAM,SAAS,CAAC;AAuDtD,MAAM,UAAU,iBAAiB,CAAC,QAAa;IAC7C,OAAO;QACL,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,KAAK,EAAE,QAAQ,CAAC,QAAQ;QACxB,IAAI,EAAE,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU;KAClE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,QAAa;IACjD,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,SAAS,EAAE,QAAQ,CAAC,YAAY;KACjC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,QAAa;IAChD,OAAO,QAAQ,CAAC,YAAY;QAC1B,CAAC,CAAC;YACE,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,QAAQ,EAAE,QAAQ,CAAC,MAAM;YACzB,SAAS,EAAE,QAAQ,CAAC,YAAY;SACjC;QACH,CAAC,CAAC;YACE,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,QAAQ,EAAE,QAAQ,CAAC,MAAM;YACzB,KAAK,EAAE,QAAQ,CAAC,QAAQ;YACxB,IAAI,EAAE,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU;SAClE,CAAC;AACR,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,QAAkB;IACtD,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,QAAQ,CAAC,SAAS,IAAI,SAAS;QAEtC,IAAI,EAAE,QAAQ,CAAC,SAAS;YACtB,CAAC,CAAE,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAqB;YACvD,CAAC,CAAC,SAAS;KACd,CAAC;AACJ,CAAC;AAID,MAAM,UAAU,gBAAgB,CAC9B,QAAa,EACb,IAA8B;IAE9B,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,IAAI,EAAE,IAAI,IAAI,QAAQ,CAAC,IAAI;KAC5B,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,QAAgC;IACnD,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC;AAC5C,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/collectVariables.d.ts: -------------------------------------------------------------------------------- 1 | import { DocumentNode, GraphQLSchema } from 'graphql'; 2 | export default function collectVariables(schema: GraphQLSchema, documentAST: DocumentNode): any; 3 | //# sourceMappingURL=collectVariables.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/collectVariables.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"collectVariables.d.ts","sourceRoot":"","sources":["../../src/utils/collectVariables.ts"],"names":[],"mappings":"AASA,OAAO,EACL,YAAY,EACZ,aAAa,EAGd,MAAM,SAAS,CAAC;AAKjB,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,YAAY,OAiB1B"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/collectVariables.js: -------------------------------------------------------------------------------- 1 | import { typeFromAST, } from 'graphql'; 2 | export default function collectVariables(schema, documentAST) { 3 | const variableToType = Object.create(null); 4 | for (const definition of documentAST.definitions) { 5 | if (definition.kind === 'OperationDefinition') { 6 | const { variableDefinitions } = definition; 7 | if (variableDefinitions) { 8 | for (const { variable, type } of variableDefinitions) { 9 | const inputType = typeFromAST(schema, type); 10 | if (inputType) { 11 | variableToType[variable.name.value] = inputType; 12 | } 13 | } 14 | } 15 | } 16 | } 17 | return variableToType; 18 | } 19 | //# sourceMappingURL=collectVariables.js.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/collectVariables.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"collectVariables.js","sourceRoot":"","sources":["../../src/utils/collectVariables.ts"],"names":[],"mappings":"AASA,OAAO,EAIL,WAAW,GACZ,MAAM,SAAS,CAAC;AAKjB,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,MAAqB,EACrB,WAAyB;IAEzB,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3C,KAAK,MAAM,UAAU,IAAI,WAAW,CAAC,WAAW,EAAE;QAChD,IAAI,UAAU,CAAC,IAAI,KAAK,qBAAqB,EAAE;YAC7C,MAAM,EAAE,mBAAmB,EAAE,GAAG,UAAU,CAAC;YAC3C,IAAI,mBAAmB,EAAE;gBACvB,KAAK,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,mBAAmB,EAAE;oBACpD,MAAM,SAAS,GAAG,WAAW,CAAC,MAAM,EAAE,IAAqB,CAAC,CAAC;oBAC7D,IAAI,SAAS,EAAE;wBACb,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;qBACjD;iBACF;aACF;SACF;KACF;IACD,OAAO,cAAc,CAAC;AACxB,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/forEachState.d.ts: -------------------------------------------------------------------------------- 1 | import type { State } from 'graphql-language-service'; 2 | export default function forEachState(stack: State, fn: (state: State) => void): void; 3 | //# sourceMappingURL=forEachState.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/forEachState.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"forEachState.d.ts","sourceRoot":"","sources":["../../src/utils/forEachState.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,KAAK,EAAS,MAAM,0BAA0B,CAAC;AAG7D,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,QAU5E"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/forEachState.js: -------------------------------------------------------------------------------- 1 | export default function forEachState(stack, fn) { 2 | const reverseStateStack = []; 3 | let state = stack; 4 | while (state === null || state === void 0 ? void 0 : state.kind) { 5 | reverseStateStack.push(state); 6 | state = state.prevState; 7 | } 8 | for (let i = reverseStateStack.length - 1; i >= 0; i--) { 9 | fn(reverseStateStack[i]); 10 | } 11 | } 12 | //# sourceMappingURL=forEachState.js.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/forEachState.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"forEachState.js","sourceRoot":"","sources":["../../src/utils/forEachState.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAY,EAAE,EAA0B;IAC3E,MAAM,iBAAiB,GAAG,EAAE,CAAC;IAC7B,IAAI,KAAK,GAAiB,KAAK,CAAC;IAChC,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,EAAE;QAClB,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9B,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC;KACzB;IACD,KAAK,IAAI,CAAC,GAAG,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QACtD,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;KAC1B;AACH,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/getTypeInfo.d.ts: -------------------------------------------------------------------------------- 1 | import { GraphQLSchema, GraphQLType, GraphQLField, GraphQLDirective, GraphQLArgument, GraphQLInputType, GraphQLEnumValue, GraphQLInputFieldMap } from 'graphql'; 2 | import type { State, Maybe } from 'graphql-language-service'; 3 | export interface TypeInfo { 4 | schema: GraphQLSchema; 5 | type?: Maybe; 6 | parentType?: Maybe; 7 | inputType?: Maybe; 8 | directiveDef?: Maybe; 9 | fieldDef?: Maybe>; 10 | argDef?: Maybe; 11 | argDefs?: Maybe; 12 | enumValue?: Maybe; 13 | objectFieldDefs?: Maybe; 14 | } 15 | export default function getTypeInfo(schema: GraphQLSchema, tokenState: State): TypeInfo; 16 | //# sourceMappingURL=getTypeInfo.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/getTypeInfo.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"getTypeInfo.d.ts","sourceRoot":"","sources":["../../src/utils/getTypeInfo.ts"],"names":[],"mappings":"AASA,OAAO,EAOL,aAAa,EACb,WAAW,EAEX,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAU7D,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAC1B,UAAU,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACpC,YAAY,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IACzC,MAAM,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,KAAK,CAAC,eAAe,EAAE,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACpC,eAAe,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;CAC/C;AAMD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,YA4G3E"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/hintList.d.ts: -------------------------------------------------------------------------------- 1 | import type CodeMirror from 'codemirror'; 2 | import { IHint, IHints } from '../hint'; 3 | export default function hintList(cursor: CodeMirror.Position, token: CodeMirror.Token, list: IHint[]): IHints | undefined; 4 | //# sourceMappingURL=hintList.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/hintList.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"hintList.d.ts","sourceRoot":"","sources":["../../src/utils/hintList.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGxC,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,MAAM,EAAE,UAAU,CAAC,QAAQ,EAC3B,KAAK,EAAE,UAAU,CAAC,KAAK,EACvB,IAAI,EAAE,KAAK,EAAE,GACZ,MAAM,GAAG,SAAS,CAgBpB"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/hintList.js: -------------------------------------------------------------------------------- 1 | export default function hintList(cursor, token, list) { 2 | const hints = filterAndSortList(list, normalizeText(token.string)); 3 | if (!hints) { 4 | return; 5 | } 6 | const tokenStart = token.type !== null && /"|\w/.test(token.string[0]) 7 | ? token.start 8 | : token.end; 9 | return { 10 | list: hints, 11 | from: { line: cursor.line, ch: tokenStart }, 12 | to: { line: cursor.line, ch: token.end }, 13 | }; 14 | } 15 | function filterAndSortList(list, text) { 16 | if (!text) { 17 | return filterNonEmpty(list, entry => !entry.isDeprecated); 18 | } 19 | const byProximity = list.map(entry => ({ 20 | proximity: getProximity(normalizeText(entry.text), text), 21 | entry, 22 | })); 23 | const conciseMatches = filterNonEmpty(filterNonEmpty(byProximity, pair => pair.proximity <= 2), pair => !pair.entry.isDeprecated); 24 | const sortedMatches = conciseMatches.sort((a, b) => (a.entry.isDeprecated ? 1 : 0) - (b.entry.isDeprecated ? 1 : 0) || 25 | a.proximity - b.proximity || 26 | a.entry.text.length - b.entry.text.length); 27 | return sortedMatches.map(pair => pair.entry); 28 | } 29 | function filterNonEmpty(array, predicate) { 30 | const filtered = array.filter(predicate); 31 | return filtered.length === 0 ? array : filtered; 32 | } 33 | function normalizeText(text) { 34 | return text.toLowerCase().replaceAll(/\W/g, ''); 35 | } 36 | function getProximity(suggestion, text) { 37 | let proximity = lexicalDistance(text, suggestion); 38 | if (suggestion.length > text.length) { 39 | proximity -= suggestion.length - text.length - 1; 40 | proximity += suggestion.indexOf(text) === 0 ? 0 : 0.5; 41 | } 42 | return proximity; 43 | } 44 | function lexicalDistance(a, b) { 45 | let i; 46 | let j; 47 | const d = []; 48 | const aLength = a.length; 49 | const bLength = b.length; 50 | for (i = 0; i <= aLength; i++) { 51 | d[i] = [i]; 52 | } 53 | for (j = 1; j <= bLength; j++) { 54 | d[0][j] = j; 55 | } 56 | for (i = 1; i <= aLength; i++) { 57 | for (j = 1; j <= bLength; j++) { 58 | const cost = a[i - 1] === b[j - 1] ? 0 : 1; 59 | d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost); 60 | if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) { 61 | d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + cost); 62 | } 63 | } 64 | } 65 | return d[aLength][bLength]; 66 | } 67 | //# sourceMappingURL=hintList.js.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/hintList.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"hintList.js","sourceRoot":"","sources":["../../src/utils/hintList.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,MAA2B,EAC3B,KAAuB,EACvB,IAAa;IAEb,MAAM,KAAK,GAAG,iBAAiB,CAAC,IAAI,EAAE,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACnE,IAAI,CAAC,KAAK,EAAE;QACV,OAAO;KACR;IAED,MAAM,UAAU,GACd,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACjD,CAAC,CAAC,KAAK,CAAC,KAAK;QACb,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;IAEhB,OAAO;QACL,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE;QAC3C,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,GAAG,EAAE;KACzC,CAAC;AACJ,CAAC;AAID,SAAS,iBAAiB,CAAC,IAAa,EAAE,IAAY;IACpD,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;KAC3D;IAED,MAAM,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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAE3C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAChB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EACf,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EACf,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CACvB,CAAC;YAEF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE;gBACpE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;aACrD;SACF;KACF;IAED,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/info-addon.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=info-addon.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/info-addon.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"info-addon.d.ts","sourceRoot":"","sources":["../../src/utils/info-addon.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/jsonParse.d.ts: -------------------------------------------------------------------------------- 1 | export default function jsonParse(str: string): ParseObjectOutput; 2 | interface BaseParseOutput { 3 | kind: string; 4 | start: number; 5 | end: number; 6 | } 7 | export interface ParseTokenOutput extends BaseParseOutput { 8 | value: any; 9 | } 10 | export interface ParseObjectOutput extends BaseParseOutput { 11 | kind: 'Object'; 12 | members: ParseMemberOutput[]; 13 | } 14 | export interface ParseArrayOutput extends BaseParseOutput { 15 | kind: 'Array'; 16 | values?: ParseValueOutput[]; 17 | } 18 | export interface ParseMemberOutput extends BaseParseOutput { 19 | key: ParseTokenOutput | null; 20 | value?: ParseValueOutput; 21 | } 22 | export declare type ParseValueOutput = ParseTokenOutput | ParseObjectOutput | ParseArrayOutput | undefined; 23 | declare type SyntaxErrorPosition = { 24 | start: number; 25 | end: number; 26 | }; 27 | export declare class JSONSyntaxError extends Error { 28 | readonly position: SyntaxErrorPosition; 29 | constructor(message: string, position: SyntaxErrorPosition); 30 | } 31 | export {}; 32 | //# sourceMappingURL=jsonParse.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/jsonParse.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"jsonParse.d.ts","sourceRoot":"","sources":["../../src/utils/jsonParse.ts"],"names":[],"mappings":"AAqBA,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,GAAG,EAAE,MAAM,qBAS5C;AAUD,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AACD,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,KAAK,EAAE,GAAG,CAAC;CACZ;AACD,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AACD,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC7B;AACD,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC7B,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B;AACD,oBAAY,gBAAgB,GACxB,gBAAgB,GAChB,iBAAiB,GACjB,gBAAgB,GAChB,SAAS,CAAC;AA6Fd,aAAK,mBAAmB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1D,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;gBAC3B,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB;CAI3D"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/jump-addon.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=jump-addon.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/jump-addon.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"jump-addon.d.ts","sourceRoot":"","sources":["../../src/utils/jump-addon.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/mode-factory.d.ts: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | declare const graphqlModeFactory: CodeMirror.ModeFactory; 3 | export default graphqlModeFactory; 4 | //# sourceMappingURL=mode-factory.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/mode-factory.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode-factory.d.ts","sourceRoot":"","sources":["../../src/utils/mode-factory.ts"],"names":[],"mappings":"AASA,OAAO,UAAU,MAAM,YAAY,CAAC;AA6BpC,QAAA,MAAM,kBAAkB,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,CAuBnD,CAAC;AAEF,eAAe,kBAAkB,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/mode-factory.js: -------------------------------------------------------------------------------- 1 | import { LexRules, ParseRules, isIgnored, onlineParser, } from 'graphql-language-service'; 2 | import indent from './mode-indent'; 3 | const graphqlModeFactory = config => { 4 | const parser = onlineParser({ 5 | eatWhitespace: stream => stream.eatWhile(isIgnored), 6 | lexRules: LexRules, 7 | parseRules: ParseRules, 8 | editorConfig: { tabSize: config.tabSize }, 9 | }); 10 | return { 11 | config, 12 | startState: parser.startState, 13 | token: parser.token, 14 | indent, 15 | electricInput: /^\s*[})\]]/, 16 | fold: 'brace', 17 | lineComment: '#', 18 | closeBrackets: { 19 | pairs: '()[]{}""', 20 | explode: '()[]{}', 21 | }, 22 | }; 23 | }; 24 | export default graphqlModeFactory; 25 | //# sourceMappingURL=mode-factory.js.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/mode-factory.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode-factory.js","sourceRoot":"","sources":["../../src/utils/mode-factory.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,QAAQ,EACR,UAAU,EACV,SAAS,EACT,YAAY,GACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,MAAM,MAAM,eAAe,CAAC;AAsBnC,MAAM,kBAAkB,GAAgC,MAAM,CAAC,EAAE;IAC/D,MAAM,MAAM,GAAG,YAAY,CAAC;QAC1B,aAAa,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QACnD,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE,UAAU;QACtB,YAAY,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE;KAC1C,CAAC,CAAC;IAEH,OAAO;QACL,MAAM;QACN,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,KAAK,EAAE,MAAM,CAAC,KAEb;QACD,MAAM;QACN,aAAa,EAAE,YAAY;QAC3B,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,GAAG;QAChB,aAAa,EAAE;YACb,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,QAAQ;SAClB;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/mode-indent.d.ts: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | import { State } from 'graphql-language-service'; 3 | export default function indent(this: CodeMirror.Mode & { 4 | electricInput?: RegExp; 5 | config?: CodeMirror.EditorConfiguration; 6 | }, state: State, textAfter: string): number; 7 | //# sourceMappingURL=mode-indent.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/mode-indent.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode-indent.d.ts","sourceRoot":"","sources":["../../src/utils/mode-indent.ts"],"names":[],"mappings":"AASA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAGjD,MAAM,CAAC,OAAO,UAAU,MAAM,CAC5B,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,UAAU,CAAC,mBAAmB,CAAC;CACzC,EACD,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,MAAM,UAUlB"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/mode-indent.js: -------------------------------------------------------------------------------- 1 | export default function indent(state, textAfter) { 2 | var _a, _b; 3 | const { levels, indentLevel } = state; 4 | const level = !levels || levels.length === 0 5 | ? indentLevel 6 | : levels.at(-1) - (((_a = this.electricInput) === null || _a === void 0 ? void 0 : _a.test(textAfter)) ? 1 : 0); 7 | return (level || 0) * (((_b = this.config) === null || _b === void 0 ? void 0 : _b.indentUnit) || 0); 8 | } 9 | //# sourceMappingURL=mode-indent.js.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/mode-indent.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode-indent.js","sourceRoot":"","sources":["../../src/utils/mode-indent.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,OAAO,UAAU,MAAM,CAK5B,KAAY,EACZ,SAAiB;;IAEjB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IAGtC,MAAM,KAAK,GACT,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAC5B,CAAC,CAAC,WAAW;QACb,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,GAAG,CAAC,CAAA,MAAA,IAAI,CAAC,aAAa,0CAAE,IAAI,CAAC,SAAS,CAAC,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrE,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,UAAU,KAAI,CAAC,CAAC,CAAC;AACvD,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/runParser.d.ts: -------------------------------------------------------------------------------- 1 | import { CharacterStream, ParserOptions, State } from 'graphql-language-service'; 2 | export default function runParser(sourceText: string, parserOptions: ParserOptions, callbackFn: (stream: CharacterStream, state: State, style: string) => void): void; 3 | //# sourceMappingURL=runParser.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/runParser.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"runParser.d.ts","sourceRoot":"","sources":["../../src/utils/runParser.ts"],"names":[],"mappings":"AASA,OAAO,EACL,eAAe,EAEf,aAAa,EACb,KAAK,EACN,MAAM,0BAA0B,CAAC;AAElC,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,QAa3E"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/runParser.js: -------------------------------------------------------------------------------- 1 | import { CharacterStream, onlineParser, } from 'graphql-language-service'; 2 | export default function runParser(sourceText, parserOptions, callbackFn) { 3 | const parser = onlineParser(parserOptions); 4 | const state = parser.startState(); 5 | const lines = sourceText.split('\n'); 6 | for (const line of lines) { 7 | const stream = new CharacterStream(line); 8 | while (!stream.eol()) { 9 | const style = parser.token(stream, state); 10 | callbackFn(stream, state, style); 11 | } 12 | } 13 | } 14 | //# sourceMappingURL=runParser.js.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/utils/runParser.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"runParser.js","sourceRoot":"","sources":["../../src/utils/runParser.ts"],"names":[],"mappings":"AASA,OAAO,EACL,eAAe,EACf,YAAY,GAGb,MAAM,0BAA0B,CAAC;AAElC,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,UAAkB,EAClB,aAA4B,EAC5B,UAA0E;IAE1E,MAAM,MAAM,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC;IAC3C,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IAClC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAErC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;QACzC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE;YACpB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YAC1C,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAClC;KACF;AACH,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/variables/hint.d.ts: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | import { GraphQLInputType } from 'graphql'; 3 | import { IHints } from '../hint'; 4 | export declare type VariableToType = Record; 5 | interface GraphQLVariableHintOptions { 6 | variableToType: VariableToType; 7 | } 8 | declare module 'codemirror' { 9 | interface ShowHintOptions { 10 | variableToType?: VariableToType; 11 | } 12 | interface CodeMirrorHintMap { 13 | 'graphql-variables': (editor: CodeMirror.Editor, options: GraphQLVariableHintOptions) => IHints | undefined; 14 | } 15 | } 16 | export {}; 17 | //# sourceMappingURL=hint.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/variables/hint.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"hint.d.ts","sourceRoot":"","sources":["../../src/variables/hint.ts"],"names":[],"mappings":"AASA,OAAO,UAAqB,MAAM,YAAY,CAAC;AAC/C,OAAO,EAOL,gBAAgB,EAEjB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAKjC,oBAAY,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAC9D,UAAU,0BAA0B;IAClC,cAAc,EAAE,cAAc,CAAC;CAChC;AAED,OAAO,QAAQ,YAAY,CAAC;IAC1B,UAAU,eAAe;QACvB,cAAc,CAAC,EAAE,cAAc,CAAC;KACjC;IAED,UAAU,iBAAiB;QACzB,mBAAmB,EAAE,CACnB,MAAM,EAAE,UAAU,CAAC,MAAM,EACzB,OAAO,EAAE,0BAA0B,KAChC,MAAM,GAAG,SAAS,CAAC;KACzB;CACF"} -------------------------------------------------------------------------------- /codemirror-graphql/esm/variables/lint.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=lint.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/variables/lint.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/variables/lint.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /codemirror-graphql/esm/variables/mode.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=mode.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/variables/mode.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode.d.ts","sourceRoot":"","sources":["../../src/variables/mode.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /codemirror-graphql/esm/variables/mode.js: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | import { list, t, onlineParser, opt, p, } from 'graphql-language-service'; 3 | import indent from '../utils/mode-indent'; 4 | CodeMirror.defineMode('graphql-variables', config => { 5 | const parser = onlineParser({ 6 | eatWhitespace: stream => stream.eatSpace(), 7 | lexRules: LexRules, 8 | parseRules: ParseRules, 9 | editorConfig: { tabSize: config.tabSize }, 10 | }); 11 | return { 12 | config, 13 | startState: parser.startState, 14 | token: parser.token, 15 | indent, 16 | electricInput: /^\s*[}\]]/, 17 | fold: 'brace', 18 | closeBrackets: { 19 | pairs: '[]{}""', 20 | explode: '[]{}', 21 | }, 22 | }; 23 | }); 24 | const LexRules = { 25 | Punctuation: /^\[|]|\{|\}|:|,/, 26 | Number: /^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/, 27 | String: /^"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?/, 28 | Keyword: /^true|false|null/, 29 | }; 30 | const ParseRules = { 31 | Document: [p('{'), list('Variable', opt(p(','))), p('}')], 32 | Variable: [namedKey('variable'), p(':'), 'Value'], 33 | Value(token) { 34 | switch (token.kind) { 35 | case 'Number': 36 | return 'NumberValue'; 37 | case 'String': 38 | return 'StringValue'; 39 | case 'Punctuation': 40 | switch (token.value) { 41 | case '[': 42 | return 'ListValue'; 43 | case '{': 44 | return 'ObjectValue'; 45 | } 46 | return null; 47 | case 'Keyword': 48 | switch (token.value) { 49 | case 'true': 50 | case 'false': 51 | return 'BooleanValue'; 52 | case 'null': 53 | return 'NullValue'; 54 | } 55 | return null; 56 | } 57 | }, 58 | NumberValue: [t('Number', 'number')], 59 | StringValue: [t('String', 'string')], 60 | BooleanValue: [t('Keyword', 'builtin')], 61 | NullValue: [t('Keyword', 'keyword')], 62 | ListValue: [p('['), list('Value', opt(p(','))), p(']')], 63 | ObjectValue: [p('{'), list('ObjectField', opt(p(','))), p('}')], 64 | ObjectField: [namedKey('attribute'), p(':'), 'Value'], 65 | }; 66 | function namedKey(style) { 67 | return { 68 | style, 69 | match: (token) => token.kind === 'String', 70 | update(state, token) { 71 | state.name = token.value.slice(1, -1); 72 | }, 73 | }; 74 | } 75 | //# sourceMappingURL=mode.js.map -------------------------------------------------------------------------------- /codemirror-graphql/esm/variables/mode.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode.js","sourceRoot":"","sources":["../../src/variables/mode.ts"],"names":[],"mappings":"AASA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EACL,IAAI,EACJ,CAAC,EACD,YAAY,EACZ,GAAG,EACH,CAAC,GAGF,MAAM,0BAA0B,CAAC;AAClC,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAM1C,UAAU,CAAC,UAAU,CAAC,mBAAmB,EAAE,MAAM,CAAC,EAAE;IAClD,MAAM,MAAM,GAAG,YAAY,CAAC;QAC1B,aAAa,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE;QAC1C,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE,UAAU;QACtB,YAAY,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE;KAC1C,CAAC,CAAC;IAEH,OAAO;QACL,MAAM;QACN,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,KAAK,EAAE,MAAM,CAAC,KAAiD;QAC/D,MAAM;QACN,aAAa,EAAE,WAAW;QAC1B,IAAI,EAAE,OAAO;QACb,aAAa,EAAE;YACb,KAAK,EAAE,QAAQ;YACf,OAAO,EAAE,MAAM;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CAAC,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACpC,SAAS,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IACvD,WAAW,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IAC/D,WAAW,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACtD,CAAC;AAGF,SAAS,QAAQ,CAAC,KAAa;IAC7B,OAAO;QACL,KAAK;QACL,KAAK,EAAE,CAAC,KAAY,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ;QAChD,MAAM,CAAC,KAAY,EAAE,KAAY;YAC/B,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACxC,CAAC;KACF,CAAC;AACJ,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/hint.d.ts: -------------------------------------------------------------------------------- 1 | import CodeMirror, { Hints, Hint } from 'codemirror'; 2 | import 'codemirror/addon/hint/show-hint'; 3 | import { FragmentDefinitionNode, GraphQLSchema, GraphQLType } from 'graphql'; 4 | import type { Maybe } from 'graphql-language-service'; 5 | export interface GraphQLHintOptions { 6 | schema?: GraphQLSchema; 7 | externalFragments?: string | FragmentDefinitionNode[]; 8 | } 9 | interface IHint extends Hint { 10 | isDeprecated?: boolean; 11 | type?: Maybe; 12 | description?: Maybe; 13 | deprecationReason?: Maybe; 14 | } 15 | interface IHints extends Hints { 16 | list: IHint[]; 17 | } 18 | declare module 'codemirror' { 19 | interface ShowHintOptions { 20 | schema?: GraphQLSchema; 21 | externalFragments?: string | FragmentDefinitionNode[]; 22 | } 23 | interface CodeMirrorHintMap { 24 | graphql: (editor: CodeMirror.Editor, options: GraphQLHintOptions) => IHints | undefined; 25 | } 26 | } 27 | export type { IHint, IHints }; 28 | //# sourceMappingURL=hint.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/hint.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"hint.d.ts","sourceRoot":"","sources":["src/hint.ts"],"names":[],"mappings":"AAWA,OAAO,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,iCAAiC,CAAC;AAEzC,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAGtD,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,GAAG,sBAAsB,EAAE,CAAC;CACvD;AAED,UAAU,KAAM,SAAQ,IAAI;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,iBAAiB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACnC;AAED,UAAU,MAAO,SAAQ,KAAK;IAC5B,IAAI,EAAE,KAAK,EAAE,CAAC;CACf;AAED,OAAO,QAAQ,YAAY,CAAC;IAC1B,UAAU,eAAe;QACvB,MAAM,CAAC,EAAE,aAAa,CAAC;QACvB,iBAAiB,CAAC,EAAE,MAAM,GAAG,sBAAsB,EAAE,CAAC;KACvD;IAED,UAAU,iBAAiB;QACzB,OAAO,EAAE,CACP,MAAM,EAAE,UAAU,CAAC,MAAM,EACzB,OAAO,EAAE,kBAAkB,KACxB,MAAM,GAAG,SAAS,CAAC;KACzB;CACF;AAuED,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/hint.esm.js: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | import 'codemirror/addon/hint/show-hint'; 3 | import { getAutocompleteSuggestions, Position } from 'graphql-language-service'; 4 | CodeMirror.registerHelper('hint', 'graphql', (editor, options) => { 5 | const { schema, externalFragments } = options; 6 | if (!schema) { 7 | return; 8 | } 9 | const cur = editor.getCursor(); 10 | const token = editor.getTokenAt(cur); 11 | const tokenStart = token.type !== null && /"|\w/.test(token.string[0]) 12 | ? token.start 13 | : token.end; 14 | const position = new Position(cur.line, tokenStart); 15 | const rawResults = getAutocompleteSuggestions(schema, editor.getValue(), position, token, externalFragments); 16 | const results = { 17 | list: rawResults.map(item => ({ 18 | text: item.label, 19 | type: item.type, 20 | description: item.documentation, 21 | isDeprecated: item.isDeprecated, 22 | deprecationReason: item.deprecationReason, 23 | })), 24 | from: { line: cur.line, ch: tokenStart }, 25 | to: { line: cur.line, ch: token.end }, 26 | }; 27 | if ((results === null || results === void 0 ? void 0 : results.list) && results.list.length > 0) { 28 | results.from = CodeMirror.Pos(results.from.line, results.from.ch); 29 | results.to = CodeMirror.Pos(results.to.line, results.to.ch); 30 | CodeMirror.signal(editor, 'hasCompletion', editor, results, token); 31 | } 32 | return results; 33 | }); 34 | //# sourceMappingURL=hint.js.map -------------------------------------------------------------------------------- /codemirror-graphql/hint.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __importDefault = (this && this.__importDefault) || function (mod) { 3 | return (mod && mod.__esModule) ? mod : { "default": mod }; 4 | }; 5 | Object.defineProperty(exports, "__esModule", { value: true }); 6 | var codemirror_1 = __importDefault(require("codemirror")); 7 | require("codemirror/addon/hint/show-hint"); 8 | var graphql_language_service_1 = require("graphql-language-service"); 9 | codemirror_1.default.registerHelper('hint', 'graphql', function (editor, options) { 10 | var schema = options.schema, externalFragments = options.externalFragments; 11 | if (!schema) { 12 | return; 13 | } 14 | var cur = editor.getCursor(); 15 | var token = editor.getTokenAt(cur); 16 | var tokenStart = token.type !== null && /"|\w/.test(token.string[0]) 17 | ? token.start 18 | : token.end; 19 | var position = new graphql_language_service_1.Position(cur.line, tokenStart); 20 | var rawResults = (0, graphql_language_service_1.getAutocompleteSuggestions)(schema, editor.getValue(), position, token, externalFragments); 21 | var results = { 22 | list: rawResults.map(function (item) { return ({ 23 | text: item.label, 24 | type: item.type, 25 | description: item.documentation, 26 | isDeprecated: item.isDeprecated, 27 | deprecationReason: item.deprecationReason, 28 | }); }), 29 | from: { line: cur.line, ch: tokenStart }, 30 | to: { line: cur.line, ch: token.end }, 31 | }; 32 | if ((results === null || results === void 0 ? void 0 : results.list) && results.list.length > 0) { 33 | results.from = codemirror_1.default.Pos(results.from.line, results.from.ch); 34 | results.to = codemirror_1.default.Pos(results.to.line, results.to.ch); 35 | codemirror_1.default.signal(editor, 'hasCompletion', editor, results, token); 36 | } 37 | return results; 38 | }); 39 | //# sourceMappingURL=hint.js.map -------------------------------------------------------------------------------- /codemirror-graphql/hint.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"hint.js","sourceRoot":"","sources":["src/hint.ts"],"names":[],"mappings":";;;;;AAWA,0DAAqD;AACrD,2CAAyC;AAIzC,qEAAgF;AAiDhF,oBAAU,CAAC,cAAc,CACvB,MAAM,EACN,SAAS,EACT,UACE,MAAyB,EACzB,OAA2B;IAEnB,IAAA,MAAM,GAAwB,OAAO,OAA/B,EAAE,iBAAiB,GAAK,OAAO,kBAAZ,CAAa;IAC9C,IAAI,CAAC,MAAM,EAAE;QACX,OAAO;KACR;IAED,IAAM,GAAG,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;IAC/B,IAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAErC,IAAM,UAAU,GACd,KAAK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,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAC5D,oBAAU,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;KACpE;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CACF,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/info.d.ts: -------------------------------------------------------------------------------- 1 | import { GraphQLSchema } from 'graphql'; 2 | import { SchemaReference } from './utils/SchemaReference'; 3 | import './utils/info-addon'; 4 | import type { Maybe } from 'graphql-language-service'; 5 | export interface GraphQLInfoOptions { 6 | schema?: GraphQLSchema; 7 | onClick?: Maybe<(ref: Maybe, e: MouseEvent) => void>; 8 | renderDescription?: (str: string) => string; 9 | render?: () => string; 10 | } 11 | //# sourceMappingURL=info.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/info.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"info.d.ts","sourceRoot":"","sources":["src/info.ts"],"names":[],"mappings":"AAUA,OAAO,EAQL,aAAa,EAEd,MAAM,SAAS,CAAC;AAIjB,OAAO,EAML,eAAe,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEtD,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC,CAAC;IACtE,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5C,MAAM,CAAC,EAAE,MAAM,MAAM,CAAC;CACvB"} -------------------------------------------------------------------------------- /codemirror-graphql/jump.d.ts: -------------------------------------------------------------------------------- 1 | import './utils/jump-addon'; 2 | import { GraphQLSchema } from 'graphql'; 3 | import type { State } from 'graphql-language-service'; 4 | export interface GraphQLJumpOptions { 5 | schema?: GraphQLSchema; 6 | onClick?: () => void; 7 | state?: State; 8 | } 9 | //# sourceMappingURL=jump.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/jump.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"jump.d.ts","sourceRoot":"","sources":["src/jump.ts"],"names":[],"mappings":"AAsBA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEtD,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf"} -------------------------------------------------------------------------------- /codemirror-graphql/jump.esm.js: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | import getTypeInfo from './utils/getTypeInfo'; 3 | import { getArgumentReference, getDirectiveReference, getEnumValueReference, getFieldReference, getTypeReference, } from './utils/SchemaReference'; 4 | import './utils/jump-addon'; 5 | CodeMirror.registerHelper('jump', 'graphql', (token, options) => { 6 | if (!options.schema || !options.onClick || !token.state) { 7 | return; 8 | } 9 | const { state } = token; 10 | const { kind, step } = state; 11 | const typeInfo = getTypeInfo(options.schema, state); 12 | if ((kind === 'Field' && step === 0 && typeInfo.fieldDef) || 13 | (kind === 'AliasedField' && step === 2 && typeInfo.fieldDef)) { 14 | return getFieldReference(typeInfo); 15 | } 16 | if (kind === 'Directive' && step === 1 && typeInfo.directiveDef) { 17 | return getDirectiveReference(typeInfo); 18 | } 19 | if (kind === 'Argument' && step === 0 && typeInfo.argDef) { 20 | return getArgumentReference(typeInfo); 21 | } 22 | if (kind === 'EnumValue' && typeInfo.enumValue) { 23 | return getEnumValueReference(typeInfo); 24 | } 25 | if (kind === 'NamedType' && typeInfo.type) { 26 | return getTypeReference(typeInfo); 27 | } 28 | }); 29 | //# sourceMappingURL=jump.js.map -------------------------------------------------------------------------------- /codemirror-graphql/jump.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __importDefault = (this && this.__importDefault) || function (mod) { 3 | return (mod && mod.__esModule) ? mod : { "default": mod }; 4 | }; 5 | Object.defineProperty(exports, "__esModule", { value: true }); 6 | var codemirror_1 = __importDefault(require("codemirror")); 7 | var getTypeInfo_1 = __importDefault(require("./utils/getTypeInfo")); 8 | var SchemaReference_1 = require("./utils/SchemaReference"); 9 | require("./utils/jump-addon"); 10 | codemirror_1.default.registerHelper('jump', 'graphql', function (token, options) { 11 | if (!options.schema || !options.onClick || !token.state) { 12 | return; 13 | } 14 | var state = token.state; 15 | var kind = state.kind, step = state.step; 16 | var typeInfo = (0, getTypeInfo_1.default)(options.schema, state); 17 | if ((kind === 'Field' && step === 0 && typeInfo.fieldDef) || 18 | (kind === 'AliasedField' && step === 2 && typeInfo.fieldDef)) { 19 | return (0, SchemaReference_1.getFieldReference)(typeInfo); 20 | } 21 | if (kind === 'Directive' && step === 1 && typeInfo.directiveDef) { 22 | return (0, SchemaReference_1.getDirectiveReference)(typeInfo); 23 | } 24 | if (kind === 'Argument' && step === 0 && typeInfo.argDef) { 25 | return (0, SchemaReference_1.getArgumentReference)(typeInfo); 26 | } 27 | if (kind === 'EnumValue' && typeInfo.enumValue) { 28 | return (0, SchemaReference_1.getEnumValueReference)(typeInfo); 29 | } 30 | if (kind === 'NamedType' && typeInfo.type) { 31 | return (0, SchemaReference_1.getTypeReference)(typeInfo); 32 | } 33 | }); 34 | //# sourceMappingURL=jump.js.map -------------------------------------------------------------------------------- /codemirror-graphql/jump.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"jump.js","sourceRoot":"","sources":["src/jump.ts"],"names":[],"mappings":";;;;;AAYA,0DAAoC;AAEpC,oEAA8C;AAC9C,2DAMiC;AACjC,8BAA4B;AAs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------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=lint.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/lint.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["src/lint.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /codemirror-graphql/lint.esm.js: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | import { getDiagnostics } from 'graphql-language-service'; 3 | const SEVERITY = ['error', 'warning', 'information', 'hint']; 4 | const TYPE = { 5 | 'GraphQL: Validation': 'validation', 6 | 'GraphQL: Deprecation': 'deprecation', 7 | 'GraphQL: Syntax': 'syntax', 8 | }; 9 | CodeMirror.registerHelper('lint', 'graphql', (text, options) => { 10 | const { schema, validationRules, externalFragments } = options; 11 | const rawResults = getDiagnostics(text, schema, validationRules, undefined, externalFragments); 12 | const results = rawResults.map(error => ({ 13 | message: error.message, 14 | severity: error.severity ? SEVERITY[error.severity - 1] : SEVERITY[0], 15 | type: error.source ? TYPE[error.source] : undefined, 16 | from: CodeMirror.Pos(error.range.start.line, error.range.start.character), 17 | to: CodeMirror.Pos(error.range.end.line, error.range.end.character), 18 | })); 19 | return results; 20 | }); 21 | //# sourceMappingURL=lint.js.map -------------------------------------------------------------------------------- /codemirror-graphql/lint.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __importDefault = (this && this.__importDefault) || function (mod) { 3 | return (mod && mod.__esModule) ? mod : { "default": mod }; 4 | }; 5 | Object.defineProperty(exports, "__esModule", { value: true }); 6 | var codemirror_1 = __importDefault(require("codemirror")); 7 | var graphql_language_service_1 = require("graphql-language-service"); 8 | var SEVERITY = ['error', 'warning', 'information', 'hint']; 9 | var TYPE = { 10 | 'GraphQL: Validation': 'validation', 11 | 'GraphQL: Deprecation': 'deprecation', 12 | 'GraphQL: Syntax': 'syntax', 13 | }; 14 | codemirror_1.default.registerHelper('lint', 'graphql', function (text, options) { 15 | var schema = options.schema, validationRules = options.validationRules, externalFragments = options.externalFragments; 16 | var rawResults = (0, graphql_language_service_1.getDiagnostics)(text, schema, validationRules, undefined, externalFragments); 17 | var results = rawResults.map(function (error) { return ({ 18 | message: error.message, 19 | severity: error.severity ? SEVERITY[error.severity - 1] : SEVERITY[0], 20 | type: error.source ? TYPE[error.source] : undefined, 21 | from: codemirror_1.default.Pos(error.range.start.line, error.range.start.character), 22 | to: codemirror_1.default.Pos(error.range.end.line, error.range.end.character), 23 | }); }); 24 | return results; 25 | }); 26 | //# sourceMappingURL=lint.js.map -------------------------------------------------------------------------------- /codemirror-graphql/lint.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"lint.js","sourceRoot":"","sources":["src/lint.ts"],"names":[],"mappings":";;;;;AASA,0DAAoC;AAEpC,qEAA0D;AAE1D,IAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;AAC7D,IAAM,IAAI,GAA2B;IACnC,qBAAqB,EAAE,YAAY;IACnC,sBAAsB,EAAE,aAAa;IACrC,iBAAiB,EAAE,QAAQ;CAC5B,CAAC;AAsBF,oBAAU,CAAC,cAAc,CACvB,MAAM,EACN,SAAS,EACT,UAAC,IAAY,EAAE,OAA2B;IAChC,IAAA,MAAM,GAAyC,OAAO,OAAhD,EAAE,eAAe,GAAwB,OAAO,gBAA/B,EAAE,iBAAiB,GAAK,OAAO,kBAAZ,CAAa;IAC/D,IAAM,UAAU,GAAG,IAAA,yCAAc,EAC/B,IAAI,EACJ,MAAM,EACN,eAAe,EACf,SAAS,EACT,iBAAiB,CAClB,CAAC;IAEF,IAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,CAAC;QACvC,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;QACnD,IAAI,EAAE,oBAAU,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC;QACzE,EAAE,EAAE,oBAAU,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC;KACpE,CAAC,EANsC,CAMtC,CAAC,CAAC;IAEJ,OAAO,OAAO,CAAC;AACjB,CAAC,CACF,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/mode.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=mode.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/mode.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode.d.ts","sourceRoot":"","sources":["src/mode.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /codemirror-graphql/mode.esm.js: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | import modeFactory from './utils/mode-factory'; 3 | CodeMirror.defineMode('graphql', modeFactory); 4 | //# sourceMappingURL=mode.js.map -------------------------------------------------------------------------------- /codemirror-graphql/mode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __importDefault = (this && this.__importDefault) || function (mod) { 3 | return (mod && mod.__esModule) ? mod : { "default": mod }; 4 | }; 5 | Object.defineProperty(exports, "__esModule", { value: true }); 6 | var codemirror_1 = __importDefault(require("codemirror")); 7 | var mode_factory_1 = __importDefault(require("./utils/mode-factory")); 8 | codemirror_1.default.defineMode('graphql', mode_factory_1.default); 9 | //# sourceMappingURL=mode.js.map -------------------------------------------------------------------------------- /codemirror-graphql/mode.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode.js","sourceRoot":"","sources":["src/mode.ts"],"names":[],"mappings":";;;;;AASA,0DAAoC;AACpC,sEAA+C;AAE/C,oBAAU,CAAC,UAAU,CAAC,SAAS,EAAE,sBAAW,CAAC,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "codemirror-graphql", 3 | "version": "2.0.8", 4 | "description": "GraphQL mode and helpers for CodeMirror.", 5 | "contributors": [ 6 | "Hyohyeon Jeong ", 7 | "Lee Byron (http://leebyron.com/)", 8 | "Angel Gomez Salazar " 9 | ], 10 | "homepage": "https://github.com/graphql/graphiql/tree/main/packages/codemirror-graphql#readme", 11 | "repository": { 12 | "type": "git", 13 | "url": "http://github.com/graphql/graphiql", 14 | "directory": "packages/codemirror-graphql" 15 | }, 16 | "bugs": { 17 | "url": "https://github.com/graphql/graphiql/issues?q=issue+label:codemirror-graphql" 18 | }, 19 | "license": "MIT", 20 | "main": "index.js", 21 | "module": "esm/index.js", 22 | "files": [ 23 | "src", 24 | "cm6-legacy", 25 | "esm", 26 | "utils", 27 | "variables", 28 | "results", 29 | "/*.js", 30 | "/*.js.flow", 31 | "/*.js.map", 32 | "/*.d.ts", 33 | "/*.d.ts.map", 34 | "!babel.config.js", 35 | "!jest.config.js" 36 | ], 37 | "scripts": { 38 | "build": "yarn build-clean && yarn build-js && yarn build-esm && yarn build-flow .", 39 | "build-js": "yarn tsc", 40 | "build-esm": "cross-env ESM=true yarn tsc --project tsconfig.esm.json && node ../../scripts/renameFileExtensions.js './esm/{**,!**/__tests__/}/*.js' . .esm.js", 41 | "build-clean": "rimraf {mode,hint,info,jump,lint}.{js,esm.js,js.flow,js.map,d.ts,d.ts.map} && rimraf esm results utils variables coverage cm6-legacy __tests__", 42 | "build-flow": "node ../../scripts/buildFlow.js", 43 | "watch": "babel --optional runtime resources/watch.js | node", 44 | "test": "jest", 45 | "postbuild": "node ../../scripts/renameFileExtensions.js './esm/{**,!**/__tests__/}/*.js' . .esm.js" 46 | }, 47 | "peerDependencies": { 48 | "@codemirror/language": "6.0.0", 49 | "codemirror": "^5.65.3", 50 | "graphql": "^15.5.0 || ^16.0.0" 51 | }, 52 | "// TEMPORARILY PINNED until we fix graphql 15 support": "", 53 | "dependencies": { 54 | "graphql-language-service": "5.1.6" 55 | }, 56 | "devDependencies": { 57 | "@codemirror/language": "6.0.0", 58 | "codemirror": "^5.65.3", 59 | "cross-env": "^7.0.2", 60 | "graphql": "^16.4.0", 61 | "rimraf": "^3.0.2", 62 | "sane": "2.0.0" 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /codemirror-graphql/results/mode.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=mode.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/results/mode.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode.d.ts","sourceRoot":"","sources":["../src/results/mode.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /codemirror-graphql/results/mode.esm.js: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | import { list, t, onlineParser, p } from 'graphql-language-service'; 3 | import indent from '../utils/mode-indent'; 4 | CodeMirror.defineMode('graphql-results', config => { 5 | const parser = onlineParser({ 6 | eatWhitespace: stream => stream.eatSpace(), 7 | lexRules: LexRules, 8 | parseRules: ParseRules, 9 | editorConfig: { tabSize: config.tabSize }, 10 | }); 11 | return { 12 | config, 13 | startState: parser.startState, 14 | token: parser.token, 15 | indent, 16 | electricInput: /^\s*[}\]]/, 17 | fold: 'brace', 18 | closeBrackets: { 19 | pairs: '[]{}""', 20 | explode: '[]{}', 21 | }, 22 | }; 23 | }); 24 | const LexRules = { 25 | Punctuation: /^\[|]|\{|\}|:|,/, 26 | Number: /^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/, 27 | String: /^"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?/, 28 | Keyword: /^true|false|null/, 29 | }; 30 | const ParseRules = { 31 | Document: [p('{'), list('Entry', p(',')), p('}')], 32 | Entry: [t('String', 'def'), p(':'), 'Value'], 33 | Value(token) { 34 | switch (token.kind) { 35 | case 'Number': 36 | return 'NumberValue'; 37 | case 'String': 38 | return 'StringValue'; 39 | case 'Punctuation': 40 | switch (token.value) { 41 | case '[': 42 | return 'ListValue'; 43 | case '{': 44 | return 'ObjectValue'; 45 | } 46 | return null; 47 | case 'Keyword': 48 | switch (token.value) { 49 | case 'true': 50 | case 'false': 51 | return 'BooleanValue'; 52 | case 'null': 53 | return 'NullValue'; 54 | } 55 | return null; 56 | } 57 | }, 58 | NumberValue: [t('Number', 'number')], 59 | StringValue: [t('String', 'string')], 60 | BooleanValue: [t('Keyword', 'builtin')], 61 | NullValue: [t('Keyword', 'keyword')], 62 | ListValue: [p('['), list('Value', p(',')), p(']')], 63 | ObjectValue: [p('{'), list('ObjectField', p(',')), p('}')], 64 | ObjectField: [t('String', 'property'), p(':'), 'Value'], 65 | }; 66 | //# sourceMappingURL=mode.js.map -------------------------------------------------------------------------------- /codemirror-graphql/results/mode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __importDefault = (this && this.__importDefault) || function (mod) { 3 | return (mod && mod.__esModule) ? mod : { "default": mod }; 4 | }; 5 | Object.defineProperty(exports, "__esModule", { value: true }); 6 | var codemirror_1 = __importDefault(require("codemirror")); 7 | var graphql_language_service_1 = require("graphql-language-service"); 8 | var mode_indent_1 = __importDefault(require("../utils/mode-indent")); 9 | codemirror_1.default.defineMode('graphql-results', function (config) { 10 | var parser = (0, graphql_language_service_1.onlineParser)({ 11 | eatWhitespace: function (stream) { return stream.eatSpace(); }, 12 | lexRules: LexRules, 13 | parseRules: ParseRules, 14 | editorConfig: { tabSize: config.tabSize }, 15 | }); 16 | return { 17 | config: config, 18 | startState: parser.startState, 19 | token: parser.token, 20 | indent: mode_indent_1.default, 21 | electricInput: /^\s*[}\]]/, 22 | fold: 'brace', 23 | closeBrackets: { 24 | pairs: '[]{}""', 25 | explode: '[]{}', 26 | }, 27 | }; 28 | }); 29 | var LexRules = { 30 | Punctuation: /^\[|]|\{|\}|:|,/, 31 | Number: /^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/, 32 | String: /^"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?/, 33 | Keyword: /^true|false|null/, 34 | }; 35 | var ParseRules = { 36 | Document: [(0, graphql_language_service_1.p)('{'), (0, graphql_language_service_1.list)('Entry', (0, graphql_language_service_1.p)(',')), (0, graphql_language_service_1.p)('}')], 37 | Entry: [(0, graphql_language_service_1.t)('String', 'def'), (0, graphql_language_service_1.p)(':'), 'Value'], 38 | Value: function (token) { 39 | switch (token.kind) { 40 | case 'Number': 41 | return 'NumberValue'; 42 | case 'String': 43 | return 'StringValue'; 44 | case 'Punctuation': 45 | switch (token.value) { 46 | case '[': 47 | return 'ListValue'; 48 | case '{': 49 | return 'ObjectValue'; 50 | } 51 | return null; 52 | case 'Keyword': 53 | switch (token.value) { 54 | case 'true': 55 | case 'false': 56 | return 'BooleanValue'; 57 | case 'null': 58 | return 'NullValue'; 59 | } 60 | return null; 61 | } 62 | }, 63 | NumberValue: [(0, graphql_language_service_1.t)('Number', 'number')], 64 | StringValue: [(0, graphql_language_service_1.t)('String', 'string')], 65 | BooleanValue: [(0, graphql_language_service_1.t)('Keyword', 'builtin')], 66 | NullValue: [(0, graphql_language_service_1.t)('Keyword', 'keyword')], 67 | ListValue: [(0, graphql_language_service_1.p)('['), (0, graphql_language_service_1.list)('Value', (0, graphql_language_service_1.p)(',')), (0, graphql_language_service_1.p)(']')], 68 | ObjectValue: [(0, graphql_language_service_1.p)('{'), (0, graphql_language_service_1.list)('ObjectField', (0, graphql_language_service_1.p)(',')), (0, graphql_language_service_1.p)('}')], 69 | ObjectField: [(0, graphql_language_service_1.t)('String', 'property'), (0, graphql_language_service_1.p)(':'), 'Value'], 70 | }; 71 | //# sourceMappingURL=mode.js.map -------------------------------------------------------------------------------- /codemirror-graphql/results/mode.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode.js","sourceRoot":"","sources":["../src/results/mode.ts"],"names":[],"mappings":";;;;;AASA,0DAAoC;AAEpC,qEAA2E;AAC3E,qEAA0C;AAM1C,oBAAU,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAA,MAAM;IAC7C,IAAM,MAAM,GAAG,IAAA,uCAAY,EAAC;QAC1B,aAAa,EAAE,UAAA,MAAM,IAAI,OAAA,MAAM,CAAC,QAAQ,EAAE,EAAjB,CAAiB;QAC1C,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE,UAAU;QACtB,YAAY,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE;KAC1C,CAAC,CAAC;IAEH,OAAO;QACL,MAAM,QAAA;QACN,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,KAAK,EAAE,MAAM,CAAC,KAAiD;QAC/D,MAAM,uBAAA;QACN,aAAa,EAAE,WAAW;QAC1B,IAAI,EAAE,OAAO;QACb,aAAa,EAAE;YACb,KAAK,EAAE,QAAQ;YACf,OAAO,EAAE,MAAM;SAChB;KACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAKH,IAAM,QAAQ,GAAG;IAEf,WAAW,EAAE,iBAAiB;IAG9B,MAAM,EAAE,2DAA2D;IAGnE,MAAM,EAAE,yDAAyD;IAGjE,OAAO,EAAE,kBAAkB;CAC5B,CAAC;AAKF,IAAM,UAAU,GAAG;IACjB,QAAQ,EAAE,CAAC,IAAA,4BAAC,EAAC,GAAG,CAAC,EAAE,IAAA,+BAAI,EAAC,OAAO,EAAE,IAAA,4BAAC,EAAC,GAAG,CAAC,CAAC,EAAE,IAAA,4BAAC,EAAC,GAAG,CAAC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EAAE,IAAA,4BAAC,EAAC,GAAG,CAAC,CAAC,EAAE,IAAA,4BAAC,EAAC,GAAG,CAAC,CAAC;IAC1D,WAAW,EAAE,CAAC,IAAA,4BAAC,EAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,IAAA,4BAAC,EAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACxD,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/src/__tests__/kitchen-sink.graphql: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 GraphQL Contributors 2 | # All rights reserved. 3 | # 4 | # This source code is licensed under the BSD-style license found in the 5 | # LICENSE file in the root directory of this source tree. An additional grant 6 | # of patent rights can be found in the PATENTS file in the same directory. 7 | 8 | query queryName($foo: TestInput, $site: TestEnum = RED) { 9 | testAlias: hasArgs(string: "testString") 10 | ... on Test { 11 | hasArgs( 12 | listEnum: [RED, GREEN, BLUE] 13 | int: 1 14 | listFloat: [1.23, 1.3e-1, -1.35384e+3] 15 | boolean: true 16 | id: 123 17 | object: $foo 18 | enum: $site 19 | ) 20 | } 21 | test @include(if: true) { 22 | union { 23 | __typename 24 | } 25 | } 26 | ...frag 27 | ... @skip(if: false) { 28 | id 29 | } 30 | ... { 31 | id 32 | } 33 | } 34 | 35 | mutation mutationName { 36 | setString(value: "newString") 37 | } 38 | 39 | subscription subscriptionName { 40 | subscribeToTest(id: "anId") { 41 | ... on Test { 42 | id 43 | } 44 | } 45 | } 46 | 47 | fragment frag on Test { 48 | test @include(if: true) { 49 | union { 50 | __typename 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /codemirror-graphql/src/__tests__/lint-test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 GraphQL Contributors 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | import CodeMirror from 'codemirror'; 11 | import 'codemirror/addon/lint/lint'; 12 | import { readFileSync } from 'node:fs'; 13 | import { join } from 'node:path'; 14 | import { GraphQLError, OperationDefinitionNode } from 'graphql'; 15 | import '../lint'; 16 | import '../mode'; 17 | import { TestSchema } from './testSchema'; 18 | 19 | function createEditorWithLint(lintConfig?: any) { 20 | return CodeMirror(document.createElement('div'), { 21 | mode: 'graphql', 22 | lint: lintConfig || true, 23 | }); 24 | } 25 | 26 | function printLintErrors(queryString: string, configOverrides = {}) { 27 | const editor = createEditorWithLint({ 28 | schema: TestSchema, 29 | ...configOverrides, 30 | }); 31 | 32 | return new Promise(resolve => { 33 | editor.state.lint.options.onUpdateLinting = (errors: any[]) => { 34 | if (errors?.[0] && !errors[0].message.match('Unexpected EOF')) { 35 | resolve(errors); 36 | return; 37 | } 38 | resolve([]); 39 | }; 40 | editor.doc.setValue(queryString); 41 | }); 42 | } 43 | 44 | describe('graphql-lint', () => { 45 | it('attaches a GraphQL lint function with correct mode/lint options', () => { 46 | const editor = createEditorWithLint(); 47 | expect(editor.getHelpers(editor.getCursor(), 'lint')).not.toHaveLength(0); 48 | }); 49 | 50 | const kitchenSink = readFileSync( 51 | join(__dirname, '/kitchen-sink.graphql'), 52 | 'utf8', 53 | ); 54 | 55 | it('returns no syntactic/validation errors after parsing kitchen-sink query', async () => { 56 | const errors = await printLintErrors(kitchenSink); 57 | expect(errors).toHaveLength(0); 58 | }); 59 | 60 | it('returns a validation error for a invalid query', async () => { 61 | const noMutationOperationRule = (context: any) => ({ 62 | OperationDefinition(node: OperationDefinitionNode) { 63 | if (node.operation === 'mutation') { 64 | context.reportError(new GraphQLError('I like turtles.', node)); 65 | } 66 | return false; 67 | }, 68 | }); 69 | const errors = await printLintErrors(kitchenSink, { 70 | validationRules: [noMutationOperationRule], 71 | }); 72 | expect(errors.length).toBe(1); 73 | expect(errors[0].message).toBe('I like turtles.'); 74 | }); 75 | }); 76 | -------------------------------------------------------------------------------- /codemirror-graphql/src/__tests__/schema-kitchen-sink.graphql: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 GraphQL Contributors 2 | # All rights reserved. 3 | # 4 | # This source code is licensed under the BSD-style license found in the 5 | # LICENSE file in the root directory of this source tree. An additional grant 6 | # of patent rights can be found in the PATENTS file in the same directory. 7 | 8 | schema { 9 | query: QueryType 10 | mutation: MutationType 11 | } 12 | 13 | type Foo implements Bar { 14 | one: Type 15 | two(argument: InputType!): Type 16 | three(argument: InputType, other: String): Int 17 | four(argument: String = "string"): String 18 | five(argument: [String] = ["string", "string"]): String 19 | six(argument: InputType = {key: "value"}): Type 20 | } 21 | 22 | type AnnotatedObject @onObject(arg: "value") { 23 | annotatedField(arg: Type = "default" @onArg): Type @onField 24 | } 25 | 26 | interface Bar { 27 | one: Type 28 | four(argument: String = "string"): String 29 | } 30 | 31 | interface AnnotatedInterface @onInterface { 32 | annotatedField(arg: Type @onArg): Type @onField 33 | } 34 | 35 | union Feed = Story | Article | Advert 36 | 37 | union AnnotatedUnion @onUnion = A | B 38 | 39 | scalar CustomScalar 40 | 41 | scalar AnnotatedScalar @onScalar 42 | 43 | enum Site { 44 | DESKTOP 45 | MOBILE 46 | } 47 | 48 | enum AnnotatedEnum @onEnum { 49 | ANNOTATED_VALUE @onEnumValue 50 | OTHER_VALUE 51 | } 52 | 53 | input InputType { 54 | key: String! 55 | answer: Int = 42 56 | } 57 | 58 | input AnnotatedInput @onInputObjectType { 59 | annotatedField: Type @onField 60 | } 61 | 62 | extend type Foo { 63 | seven(argument: [[String!]!]!): Type 64 | } 65 | 66 | extend type Foo @onType {} 67 | 68 | type NoFields {} 69 | 70 | directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT 71 | 72 | directive @include(if: Boolean!) 73 | on FIELD 74 | | FRAGMENT_SPREAD 75 | | INLINE_FRAGMENT 76 | -------------------------------------------------------------------------------- /codemirror-graphql/src/cm6-legacy/mode.ts: -------------------------------------------------------------------------------- 1 | import type { StreamParser } from '@codemirror/language'; 2 | import graphqlModeFactory from '../utils/mode-factory'; 3 | 4 | // Types of property 'token' are incompatible. 5 | // Type '((stream: StringStream, state: any) => string | null) | undefined' is not comparable to type '(stream: StringStream, state: any) => string | null'. 6 | export const graphql = graphqlModeFactory({}) as unknown as StreamParser; 7 | -------------------------------------------------------------------------------- /codemirror-graphql/src/index.d.ts: -------------------------------------------------------------------------------- 1 | import 'codemirror/addon/hint/show-hint'; 2 | 3 | declare module 'codemirror' { 4 | let Init: any; 5 | 6 | interface Editor { 7 | doc: CodeMirror.Doc; 8 | getHelper(pos: { line: number; ch: number }, type: string): any; 9 | getHelpers(pos: { line: number; ch: number }, type: string): any[]; 10 | } 11 | 12 | interface ShowHintOptions { 13 | hint?: ShowHintOptions['hint']; 14 | } 15 | 16 | interface CodeMirrorHintMap {} 17 | 18 | const hint: CodeMirrorHintMap; 19 | } 20 | -------------------------------------------------------------------------------- /codemirror-graphql/src/jump.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 GraphQL Contributors 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @flow 10 | * 11 | */ 12 | 13 | import CodeMirror from 'codemirror'; 14 | 15 | import getTypeInfo from './utils/getTypeInfo'; 16 | import { 17 | getArgumentReference, 18 | getDirectiveReference, 19 | getEnumValueReference, 20 | getFieldReference, 21 | getTypeReference, 22 | } from './utils/SchemaReference'; 23 | import './utils/jump-addon'; 24 | import { GraphQLSchema } from 'graphql'; 25 | import type { State } from 'graphql-language-service'; 26 | 27 | export interface GraphQLJumpOptions { 28 | schema?: GraphQLSchema; 29 | onClick?: () => void; 30 | state?: State; 31 | } 32 | 33 | /** 34 | * Registers GraphQL "jump" links for CodeMirror. 35 | * 36 | * When command-hovering over a token, this converts it to a link, which when 37 | * pressed will call the provided onClick handler. 38 | * 39 | * Options: 40 | * 41 | * - schema: GraphQLSchema provides positionally relevant info. 42 | * - onClick: A function called when a named thing is clicked. 43 | * 44 | */ 45 | CodeMirror.registerHelper( 46 | 'jump', 47 | 'graphql', 48 | (token: CodeMirror.Token, options: GraphQLJumpOptions) => { 49 | if (!options.schema || !options.onClick || !token.state) { 50 | return; 51 | } 52 | 53 | // Given a Schema and a Token, produce a "SchemaReference" which refers to 54 | // the particular artifact from the schema (such as a type, field, argument, 55 | // or directive) that token references. 56 | const { state } = token; 57 | const { kind, step } = state; 58 | const typeInfo = getTypeInfo(options.schema, state); 59 | 60 | if ( 61 | (kind === 'Field' && step === 0 && typeInfo.fieldDef) || 62 | (kind === 'AliasedField' && step === 2 && typeInfo.fieldDef) 63 | ) { 64 | return getFieldReference(typeInfo); 65 | } 66 | if (kind === 'Directive' && step === 1 && typeInfo.directiveDef) { 67 | return getDirectiveReference(typeInfo); 68 | } 69 | if (kind === 'Argument' && step === 0 && typeInfo.argDef) { 70 | return getArgumentReference(typeInfo); 71 | } 72 | if (kind === 'EnumValue' && typeInfo.enumValue) { 73 | return getEnumValueReference(typeInfo); 74 | } 75 | if (kind === 'NamedType' && typeInfo.type) { 76 | return getTypeReference(typeInfo); 77 | } 78 | }, 79 | ); 80 | -------------------------------------------------------------------------------- /codemirror-graphql/src/lint.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 GraphQL Contributors 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | import CodeMirror from 'codemirror'; 11 | import { FragmentDefinitionNode, GraphQLSchema, ValidationRule } from 'graphql'; 12 | import { getDiagnostics } from 'graphql-language-service'; 13 | 14 | const SEVERITY = ['error', 'warning', 'information', 'hint']; 15 | const TYPE: Record = { 16 | 'GraphQL: Validation': 'validation', 17 | 'GraphQL: Deprecation': 'deprecation', 18 | 'GraphQL: Syntax': 'syntax', 19 | }; 20 | 21 | interface GraphQLLintOptions { 22 | schema?: GraphQLSchema; 23 | validationRules: ValidationRule[]; 24 | externalFragments?: string | FragmentDefinitionNode[]; 25 | } 26 | 27 | /** 28 | * Registers a "lint" helper for CodeMirror. 29 | * 30 | * Using CodeMirror's "lint" addon: https://codemirror.net/demo/lint.html 31 | * Given the text within an editor, this helper will take that text and return 32 | * a list of linter issues, derived from GraphQL's parse and validate steps. 33 | * Also, this uses `graphql-language-service-parser` to power the diagnostics 34 | * service. 35 | * 36 | * Options: 37 | * 38 | * - schema: GraphQLSchema provides the linter with positionally relevant info 39 | * 40 | */ 41 | CodeMirror.registerHelper( 42 | 'lint', 43 | 'graphql', 44 | (text: string, options: GraphQLLintOptions): CodeMirror.Annotation[] => { 45 | const { schema, validationRules, externalFragments } = options; 46 | const rawResults = getDiagnostics( 47 | text, 48 | schema, 49 | validationRules, 50 | undefined, 51 | externalFragments, 52 | ); 53 | 54 | const results = rawResults.map(error => ({ 55 | message: error.message, 56 | severity: error.severity ? SEVERITY[error.severity - 1] : SEVERITY[0], 57 | type: error.source ? TYPE[error.source] : undefined, 58 | from: CodeMirror.Pos(error.range.start.line, error.range.start.character), 59 | to: CodeMirror.Pos(error.range.end.line, error.range.end.character), 60 | })); 61 | 62 | return results; 63 | }, 64 | ); 65 | -------------------------------------------------------------------------------- /codemirror-graphql/src/mode.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 GraphQL Contributors 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | import CodeMirror from 'codemirror'; 11 | import modeFactory from './utils/mode-factory'; 12 | 13 | CodeMirror.defineMode('graphql', modeFactory); 14 | -------------------------------------------------------------------------------- /codemirror-graphql/src/results/__tests__/mode-test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 GraphQL Contributors 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | import CodeMirror from 'codemirror'; 11 | import 'codemirror/addon/runmode/runmode'; 12 | import '../mode'; 13 | 14 | describe('graphql-results-mode', () => { 15 | it('provides correct tokens and styles after parsing', () => { 16 | const queryStr = 17 | '{ "data": { "field": "value" }, "errors": [ { "message": "bork" } ] }'; 18 | const tokens: [string, string][] = []; 19 | 20 | CodeMirror.runMode(queryStr, 'graphql-results', (token, style) => { 21 | if (style && style !== 'ws') { 22 | tokens.push([token, style]); 23 | } 24 | }); 25 | 26 | expect(tokens).toEqual([ 27 | ['{', 'punctuation'], 28 | ['"data"', 'def'], 29 | [':', 'punctuation'], 30 | ['{', 'punctuation'], 31 | ['"field"', 'property'], 32 | [':', 'punctuation'], 33 | ['"value"', 'string'], 34 | ['}', 'punctuation'], 35 | [',', 'punctuation'], 36 | ['"errors"', 'def'], 37 | [':', 'punctuation'], 38 | ['[', 'punctuation'], 39 | ['{', 'punctuation'], 40 | ['"message"', 'property'], 41 | [':', 'punctuation'], 42 | ['"bork"', 'string'], 43 | ['}', 'punctuation'], 44 | [']', 'punctuation'], 45 | ['}', 'punctuation'], 46 | ]); 47 | }); 48 | }); 49 | -------------------------------------------------------------------------------- /codemirror-graphql/src/results/mode.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 GraphQL Contributors 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | import CodeMirror from 'codemirror'; 11 | 12 | import { list, t, onlineParser, p, Token } from 'graphql-language-service'; 13 | import indent from '../utils/mode-indent'; 14 | 15 | /** 16 | * This mode defines JSON, but provides a data-laden parser state to enable 17 | * better code intelligence. 18 | */ 19 | CodeMirror.defineMode('graphql-results', config => { 20 | const parser = onlineParser({ 21 | eatWhitespace: stream => stream.eatSpace(), 22 | lexRules: LexRules, 23 | parseRules: ParseRules, 24 | editorConfig: { tabSize: config.tabSize }, 25 | }); 26 | 27 | return { 28 | config, 29 | startState: parser.startState, 30 | token: parser.token as unknown as CodeMirror.Mode['token'], // TODO: Check if the types are indeed compatible 31 | indent, 32 | electricInput: /^\s*[}\]]/, 33 | fold: 'brace', 34 | closeBrackets: { 35 | pairs: '[]{}""', 36 | explode: '[]{}', 37 | }, 38 | }; 39 | }); 40 | 41 | /** 42 | * The lexer rules. These are exactly as described by the spec. 43 | */ 44 | const LexRules = { 45 | // All Punctuation used in JSON. 46 | Punctuation: /^\[|]|\{|\}|:|,/, 47 | 48 | // JSON Number. 49 | Number: /^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/, 50 | 51 | // JSON String. 52 | String: /^"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?/, 53 | 54 | // JSON literal keywords. 55 | Keyword: /^true|false|null/, 56 | }; 57 | 58 | /** 59 | * The parser rules for JSON. 60 | */ 61 | const ParseRules = { 62 | Document: [p('{'), list('Entry', p(',')), p('}')], 63 | Entry: [t('String', 'def'), p(':'), 'Value'], 64 | Value(token: Token) { 65 | switch (token.kind) { 66 | case 'Number': 67 | return 'NumberValue'; 68 | case 'String': 69 | return 'StringValue'; 70 | case 'Punctuation': 71 | switch (token.value) { 72 | case '[': 73 | return 'ListValue'; 74 | case '{': 75 | return 'ObjectValue'; 76 | } 77 | return null; 78 | case 'Keyword': 79 | switch (token.value) { 80 | case 'true': 81 | case 'false': 82 | return 'BooleanValue'; 83 | case 'null': 84 | return 'NullValue'; 85 | } 86 | return null; 87 | } 88 | }, 89 | NumberValue: [t('Number', 'number')], 90 | StringValue: [t('String', 'string')], 91 | BooleanValue: [t('Keyword', 'builtin')], 92 | NullValue: [t('Keyword', 'keyword')], 93 | ListValue: [p('['), list('Value', p(',')), p(']')], 94 | ObjectValue: [p('{'), list('ObjectField', p(',')), p('}')], 95 | ObjectField: [t('String', 'property'), p(':'), 'Value'], 96 | }; 97 | -------------------------------------------------------------------------------- /codemirror-graphql/src/utils/__tests__/jsonParse-test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 GraphQL Contributors 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | import jsonParse, { ParseTokenOutput } from '../jsonParse'; 10 | 11 | describe('jsonParse', () => { 12 | function expectEscapedString( 13 | str: string, 14 | key: ParseTokenOutput, 15 | value: ParseTokenOutput, 16 | ) { 17 | const ast = jsonParse(str); 18 | expect(ast.kind).toBe('Object'); 19 | expect(ast.members[0].key).toStrictEqual(key); 20 | expect(ast.members[0].value).toStrictEqual(value); 21 | } 22 | 23 | it('correctly parses escaped strings', () => { 24 | expectEscapedString( 25 | '{ "test": "\\"" }', 26 | { kind: 'String', start: 2, end: 8, value: 'test' }, 27 | { kind: 'String', start: 10, end: 14, value: '"' }, 28 | ); 29 | expectEscapedString( 30 | '{ "test": "\\\\" }', 31 | { kind: 'String', start: 2, end: 8, value: 'test' }, 32 | { kind: 'String', start: 10, end: 14, value: '\\' }, 33 | ); 34 | expectEscapedString( 35 | '{ "slash": "\\/" }', 36 | { kind: 'String', start: 2, end: 9, value: 'slash' }, 37 | { kind: 'String', start: 11, end: 15, value: '/' }, 38 | ); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /codemirror-graphql/src/utils/collectVariables.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 GraphQL Contributors 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | import { 11 | DocumentNode, 12 | GraphQLSchema, 13 | NamedTypeNode, 14 | typeFromAST, 15 | } from 'graphql'; 16 | 17 | /** 18 | * Provided a schema and a document, produces a `variableToType` Object. 19 | */ 20 | export default function collectVariables( 21 | schema: GraphQLSchema, 22 | documentAST: DocumentNode, 23 | ) { 24 | const variableToType = Object.create(null); 25 | for (const definition of documentAST.definitions) { 26 | if (definition.kind === 'OperationDefinition') { 27 | const { variableDefinitions } = definition; 28 | if (variableDefinitions) { 29 | for (const { variable, type } of variableDefinitions) { 30 | const inputType = typeFromAST(schema, type as NamedTypeNode); 31 | if (inputType) { 32 | variableToType[variable.name.value] = inputType; 33 | } 34 | } 35 | } 36 | } 37 | } 38 | return variableToType; 39 | } 40 | -------------------------------------------------------------------------------- /codemirror-graphql/src/utils/forEachState.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 GraphQL Contributors 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | import type { State, Maybe } from 'graphql-language-service'; 11 | 12 | // Utility for iterating through a CodeMirror parse state stack bottom-up. 13 | export default function forEachState(stack: State, fn: (state: State) => void) { 14 | const reverseStateStack = []; 15 | let state: Maybe = stack; 16 | while (state?.kind) { 17 | reverseStateStack.push(state); 18 | state = state.prevState; 19 | } 20 | for (let i = reverseStateStack.length - 1; i >= 0; i--) { 21 | fn(reverseStateStack[i]); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /codemirror-graphql/src/utils/mode-factory.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 GraphQL Contributors 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | import CodeMirror from 'codemirror'; 11 | import { 12 | LexRules, 13 | ParseRules, 14 | isIgnored, 15 | onlineParser, 16 | } from 'graphql-language-service'; 17 | import indent from './mode-indent'; 18 | 19 | /** 20 | * The GraphQL mode is defined as a tokenizer along with a list of rules, each 21 | * of which is either a function or an array. 22 | * 23 | * * Function: Provided a token and the stream, returns an expected next step. 24 | * * Array: A list of steps to take in order. 25 | * 26 | * A step is either another rule, or a terminal description of a token. If it 27 | * is a rule, that rule is pushed onto the stack and the parsing continues from 28 | * that point. 29 | * 30 | * If it is a terminal description, the token is checked against it using a 31 | * `match` function. If the match is successful, the token is colored and the 32 | * rule is stepped forward. If the match is unsuccessful, the remainder of the 33 | * rule is skipped and the previous rule is advanced. 34 | * 35 | * This parsing algorithm allows for incremental online parsing within various 36 | * levels of the syntax tree and results in a structured `state` linked-list 37 | * which contains the relevant information to produce valuable typeahead. 38 | */ 39 | const graphqlModeFactory: CodeMirror.ModeFactory = config => { 40 | const parser = onlineParser({ 41 | eatWhitespace: stream => stream.eatWhile(isIgnored), 42 | lexRules: LexRules, 43 | parseRules: ParseRules, 44 | editorConfig: { tabSize: config.tabSize }, 45 | }); 46 | 47 | return { 48 | config, 49 | startState: parser.startState, 50 | token: parser.token as unknown as NonNullable< 51 | CodeMirror.Mode['token'] 52 | >, // TODO: Check if the types are indeed compatible 53 | indent, 54 | electricInput: /^\s*[})\]]/, 55 | fold: 'brace', 56 | lineComment: '#', 57 | closeBrackets: { 58 | pairs: '()[]{}""', 59 | explode: '()[]{}', 60 | }, 61 | }; 62 | }; 63 | 64 | export default graphqlModeFactory; 65 | -------------------------------------------------------------------------------- /codemirror-graphql/src/utils/mode-indent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 GraphQL Contributors 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | import CodeMirror from 'codemirror'; 11 | import { State } from 'graphql-language-service'; 12 | 13 | // Seems the electricInput type in @types/codemirror is wrong (i.e it is written all lowercase) 14 | export default function indent( 15 | this: CodeMirror.Mode & { 16 | electricInput?: RegExp; 17 | config?: CodeMirror.EditorConfiguration; 18 | }, 19 | state: State, 20 | textAfter: string, 21 | ) { 22 | const { levels, indentLevel } = state; 23 | // If there is no stack of levels, use the current level. 24 | // Otherwise, use the top level, preemptively dedenting for close braces. 25 | const level = 26 | !levels || levels.length === 0 27 | ? indentLevel 28 | : levels.at(-1)! - (this.electricInput?.test(textAfter) ? 1 : 0); 29 | return (level || 0) * (this.config?.indentUnit || 0); 30 | } 31 | -------------------------------------------------------------------------------- /codemirror-graphql/src/utils/runParser.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 GraphQL Contributors 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | import { 11 | CharacterStream, 12 | onlineParser, 13 | ParserOptions, 14 | State, 15 | } from 'graphql-language-service'; 16 | 17 | export default function runParser( 18 | sourceText: string, 19 | parserOptions: ParserOptions, 20 | callbackFn: (stream: CharacterStream, state: State, style: string) => void, 21 | ) { 22 | const parser = onlineParser(parserOptions); 23 | const state = parser.startState(); 24 | const lines = sourceText.split('\n'); 25 | 26 | for (const line of lines) { 27 | const stream = new CharacterStream(line); 28 | while (!stream.eol()) { 29 | const style = parser.token(stream, state); 30 | callbackFn(stream, state, style); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /codemirror-graphql/src/variables/__tests__/lint-test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 GraphQL Contributors 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | import CodeMirror from 'codemirror'; 11 | import 'codemirror/addon/lint/lint'; 12 | import { parse } from 'graphql'; 13 | import { Maybe } from 'graphql-language-service'; 14 | import collectVariables from '../../utils/collectVariables'; 15 | import { TestSchema } from '../../__tests__/testSchema'; 16 | import '../lint'; 17 | import '../mode'; 18 | 19 | function createEditorWithLint(lintConfig?: any) { 20 | return CodeMirror(document.createElement('div'), { 21 | mode: 'graphql-variables', 22 | lint: lintConfig || true, 23 | }); 24 | } 25 | 26 | function printLintErrors(query: Maybe, variables: string) { 27 | const editor = createEditorWithLint({ 28 | variableToType: query && collectVariables(TestSchema, parse(query)), 29 | }); 30 | 31 | return new Promise(resolve => { 32 | editor.state.lint.options.onUpdateLinting = ( 33 | errors: CodeMirror.Annotation[], 34 | ) => { 35 | if (errors?.[0] && !errors[0].message?.match('Unexpected EOF')) { 36 | resolve(errors); 37 | return; 38 | } 39 | resolve([]); 40 | }; 41 | editor.doc.setValue(variables); 42 | }); 43 | } 44 | 45 | describe('graphql-variables-lint', () => { 46 | it('attaches a GraphQL lint function with correct mode/lint options', () => { 47 | const editor = createEditorWithLint(); 48 | expect(editor.getHelpers(editor.getCursor(), 'lint')).not.toHaveLength(0); 49 | }); 50 | 51 | it('catches syntax errors', async () => { 52 | expect((await printLintErrors(null, '{ foo: "bar" }'))[0].message).toBe( 53 | 'Expected String but found `foo`.', 54 | ); 55 | }); 56 | 57 | it('catches type validation errors', async () => { 58 | const errors = await printLintErrors( 59 | 'query ($foo: Int) { f }', 60 | ' { "foo": "NaN" }', 61 | ); 62 | 63 | expect(errors[0]).toEqual({ 64 | message: 'Expected value of type "Int".', 65 | severity: 'error', 66 | type: 'validation', 67 | from: { line: 0, ch: 10, sticky: null }, 68 | to: { line: 0, ch: 15, sticky: null }, 69 | }); 70 | }); 71 | 72 | it('reports unknown variable names', async () => { 73 | const errors = await printLintErrors( 74 | 'query ($foo: Int) { f }', 75 | ' { "food": "NaN" }', 76 | ); 77 | 78 | expect(errors[0]).toEqual({ 79 | message: 'Variable "$food" does not appear in any GraphQL query.', 80 | severity: 'error', 81 | type: 'validation', 82 | from: { line: 0, ch: 3, sticky: null }, 83 | to: { line: 0, ch: 9, sticky: null }, 84 | }); 85 | }); 86 | 87 | it('reports nothing when not configured', async () => { 88 | const errors = await printLintErrors(null, ' { "foo": "NaN" }'); 89 | expect(errors.length).toBe(0); 90 | }); 91 | }); 92 | -------------------------------------------------------------------------------- /codemirror-graphql/src/variables/__tests__/mode-test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 GraphQL Contributors 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | import CodeMirror from 'codemirror'; 11 | import 'codemirror/addon/runmode/runmode'; 12 | import '../mode'; 13 | 14 | describe('graphql-variables-mode', () => { 15 | it('provides correct tokens and styles after parsing', () => { 16 | const queryStr = 17 | '{ "variable": { "field": "value" }, "list": [ 1, true, null ] }'; 18 | const tokens: [string, string][] = []; 19 | 20 | CodeMirror.runMode(queryStr, 'graphql-variables', (token, style) => { 21 | if (style && style !== 'ws') { 22 | tokens.push([token, style]); 23 | } 24 | }); 25 | 26 | expect(tokens).toEqual([ 27 | ['{', 'punctuation'], 28 | ['"variable"', 'variable'], 29 | [':', 'punctuation'], 30 | ['{', 'punctuation'], 31 | ['"field"', 'attribute'], 32 | [':', 'punctuation'], 33 | ['"value"', 'string'], 34 | ['}', 'punctuation'], 35 | [',', 'punctuation'], 36 | ['"list"', 'variable'], 37 | [':', 'punctuation'], 38 | ['[', 'punctuation'], 39 | ['1', 'number'], 40 | [',', 'punctuation'], 41 | ['true', 'builtin'], 42 | [',', 'punctuation'], 43 | ['null', 'keyword'], 44 | [']', 'punctuation'], 45 | ['}', 'punctuation'], 46 | ]); 47 | }); 48 | 49 | it('is resilient to missing commas', () => { 50 | const queryStr = 51 | '{ "variable": { "field": "value" } "list": [ 1 true null ] }'; 52 | const tokens: [string, string][] = []; 53 | 54 | CodeMirror.runMode(queryStr, 'graphql-variables', (token, style) => { 55 | if (style && style !== 'ws') { 56 | tokens.push([token, style]); 57 | } 58 | }); 59 | 60 | expect(tokens).toEqual([ 61 | ['{', 'punctuation'], 62 | ['"variable"', 'variable'], 63 | [':', 'punctuation'], 64 | ['{', 'punctuation'], 65 | ['"field"', 'attribute'], 66 | [':', 'punctuation'], 67 | ['"value"', 'string'], 68 | ['}', 'punctuation'], 69 | ['"list"', 'variable'], 70 | [':', 'punctuation'], 71 | ['[', 'punctuation'], 72 | ['1', 'number'], 73 | ['true', 'builtin'], 74 | ['null', 'keyword'], 75 | [']', 'punctuation'], 76 | ['}', 'punctuation'], 77 | ]); 78 | }); 79 | 80 | it('returns "invalidchar" message when there is no matching token', () => { 81 | CodeMirror.runMode('nope', 'graphql-variables', (token, style) => { 82 | if (token.trim()) { 83 | expect(style).toBe('invalidchar'); 84 | } 85 | }); 86 | 87 | CodeMirror.runMode('{ foo', 'graphql-variables', (token, style) => { 88 | if (token === 'foo') { 89 | expect(style).toBe('invalidchar'); 90 | } 91 | }); 92 | }); 93 | }); 94 | -------------------------------------------------------------------------------- /codemirror-graphql/src/variables/mode.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 GraphQL Contributors 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | import CodeMirror from 'codemirror'; 11 | 12 | import { 13 | list, 14 | t, 15 | onlineParser, 16 | opt, 17 | p, 18 | State, 19 | Token, 20 | } from 'graphql-language-service'; 21 | import indent from '../utils/mode-indent'; 22 | 23 | /** 24 | * This mode defines JSON, but provides a data-laden parser state to enable 25 | * better code intelligence. 26 | */ 27 | CodeMirror.defineMode('graphql-variables', config => { 28 | const parser = onlineParser({ 29 | eatWhitespace: stream => stream.eatSpace(), 30 | lexRules: LexRules, 31 | parseRules: ParseRules, 32 | editorConfig: { tabSize: config.tabSize }, 33 | }); 34 | 35 | return { 36 | config, 37 | startState: parser.startState, 38 | token: parser.token as unknown as CodeMirror.Mode['token'], // TODO: Check if the types are indeed compatible 39 | indent, 40 | electricInput: /^\s*[}\]]/, 41 | fold: 'brace', 42 | closeBrackets: { 43 | pairs: '[]{}""', 44 | explode: '[]{}', 45 | }, 46 | }; 47 | }); 48 | 49 | /** 50 | * The lexer rules. These are exactly as described by the spec. 51 | */ 52 | const LexRules = { 53 | // All Punctuation used in JSON. 54 | Punctuation: /^\[|]|\{|\}|:|,/, 55 | 56 | // JSON Number. 57 | Number: /^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/, 58 | 59 | // JSON String. 60 | String: /^"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?/, 61 | 62 | // JSON literal keywords. 63 | Keyword: /^true|false|null/, 64 | }; 65 | 66 | /** 67 | * The parser rules for JSON. 68 | */ 69 | const ParseRules = { 70 | Document: [p('{'), list('Variable', opt(p(','))), p('}')], 71 | Variable: [namedKey('variable'), p(':'), 'Value'], 72 | Value(token: Token) { 73 | switch (token.kind) { 74 | case 'Number': 75 | return 'NumberValue'; 76 | case 'String': 77 | return 'StringValue'; 78 | case 'Punctuation': 79 | switch (token.value) { 80 | case '[': 81 | return 'ListValue'; 82 | case '{': 83 | return 'ObjectValue'; 84 | } 85 | return null; 86 | case 'Keyword': 87 | switch (token.value) { 88 | case 'true': 89 | case 'false': 90 | return 'BooleanValue'; 91 | case 'null': 92 | return 'NullValue'; 93 | } 94 | return null; 95 | } 96 | }, 97 | NumberValue: [t('Number', 'number')], 98 | StringValue: [t('String', 'string')], 99 | BooleanValue: [t('Keyword', 'builtin')], 100 | NullValue: [t('Keyword', 'keyword')], 101 | ListValue: [p('['), list('Value', opt(p(','))), p(']')], 102 | ObjectValue: [p('{'), list('ObjectField', opt(p(','))), p('}')], 103 | ObjectField: [namedKey('attribute'), p(':'), 'Value'], 104 | }; 105 | 106 | // A namedKey Token which will decorate the state with a `name` 107 | function namedKey(style: string) { 108 | return { 109 | style, 110 | match: (token: Token) => token.kind === 'String', 111 | update(state: State, token: Token) { 112 | state.name = token.value.slice(1, -1); // Remove quotes. 113 | }, 114 | }; 115 | } 116 | -------------------------------------------------------------------------------- /codemirror-graphql/utils/SchemaReference.d.ts: -------------------------------------------------------------------------------- 1 | import { GraphQLSchema } from 'graphql'; 2 | import type { GraphQLArgument, GraphQLDirective, GraphQLEnumValue, GraphQLEnumType, GraphQLField, GraphQLNamedType } from 'graphql'; 3 | import { Maybe } from 'graphql/jsutils/Maybe'; 4 | import { TypeInfo } from './getTypeInfo'; 5 | export declare type SchemaReference = FieldReference | DirectiveReference | ArgumentReference | EnumValueReference | TypeReference; 6 | export declare type FieldReference = { 7 | kind: 'Field'; 8 | field: GraphQLField; 9 | type: Maybe; 10 | schema?: GraphQLSchema; 11 | }; 12 | export declare type DirectiveReference = { 13 | kind: 'Directive'; 14 | directive: GraphQLDirective; 15 | schema?: GraphQLSchema; 16 | }; 17 | export declare type ArgumentReference = { 18 | kind: 'Argument'; 19 | argument: GraphQLArgument; 20 | field?: GraphQLField; 21 | type?: GraphQLNamedType; 22 | directive?: GraphQLDirective; 23 | schema?: GraphQLSchema; 24 | }; 25 | export declare type EnumValueReference = { 26 | kind: 'EnumValue'; 27 | value?: GraphQLEnumValue; 28 | type?: GraphQLEnumType; 29 | schema?: GraphQLSchema; 30 | }; 31 | export declare type TypeReference = { 32 | kind: 'Type'; 33 | type: GraphQLNamedType; 34 | schema?: GraphQLSchema; 35 | }; 36 | export declare function getFieldReference(typeInfo: any): FieldReference; 37 | export declare function getDirectiveReference(typeInfo: any): DirectiveReference; 38 | export declare function getArgumentReference(typeInfo: any): ArgumentReference; 39 | export declare function getEnumValueReference(typeInfo: TypeInfo): EnumValueReference; 40 | export declare function getTypeReference(typeInfo: any, type?: Maybe): TypeReference; 41 | //# sourceMappingURL=SchemaReference.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/SchemaReference.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"SchemaReference.d.ts","sourceRoot":"","sources":["../src/utils/SchemaReference.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,aAAa,EAAE,MAAM,SAAS,CAAC;AAEtD,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,gBAAgB,EACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,oBAAY,eAAe,GACvB,cAAc,GACd,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,aAAa,CAAC;AAElB,oBAAY,cAAc,GAAG;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC9B,IAAI,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,oBAAY,iBAAiB,GAAG;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,CAAC,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,oBAAY,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,GAAG,GAAG,cAAc,CAO/D;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,GAAG,GAAG,kBAAkB,CAMvE;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,GAAG,GAAG,iBAAiB,CAerE;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,kBAAkB,CAS5E;AAID,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,GAAG,EACb,IAAI,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAC7B,aAAa,CAMf"} -------------------------------------------------------------------------------- /codemirror-graphql/utils/SchemaReference.esm.js: -------------------------------------------------------------------------------- 1 | import { getNamedType } from 'graphql'; 2 | export function getFieldReference(typeInfo) { 3 | return { 4 | kind: 'Field', 5 | schema: typeInfo.schema, 6 | field: typeInfo.fieldDef, 7 | type: isMetaField(typeInfo.fieldDef) ? null : typeInfo.parentType, 8 | }; 9 | } 10 | export function getDirectiveReference(typeInfo) { 11 | return { 12 | kind: 'Directive', 13 | schema: typeInfo.schema, 14 | directive: typeInfo.directiveDef, 15 | }; 16 | } 17 | export function getArgumentReference(typeInfo) { 18 | return typeInfo.directiveDef 19 | ? { 20 | kind: 'Argument', 21 | schema: typeInfo.schema, 22 | argument: typeInfo.argDef, 23 | directive: typeInfo.directiveDef, 24 | } 25 | : { 26 | kind: 'Argument', 27 | schema: typeInfo.schema, 28 | argument: typeInfo.argDef, 29 | field: typeInfo.fieldDef, 30 | type: isMetaField(typeInfo.fieldDef) ? null : typeInfo.parentType, 31 | }; 32 | } 33 | export function getEnumValueReference(typeInfo) { 34 | return { 35 | kind: 'EnumValue', 36 | value: typeInfo.enumValue || undefined, 37 | type: typeInfo.inputType 38 | ? getNamedType(typeInfo.inputType) 39 | : undefined, 40 | }; 41 | } 42 | export function getTypeReference(typeInfo, type) { 43 | return { 44 | kind: 'Type', 45 | schema: typeInfo.schema, 46 | type: type || typeInfo.type, 47 | }; 48 | } 49 | function isMetaField(fieldDef) { 50 | return fieldDef.name.slice(0, 2) === '__'; 51 | } 52 | //# sourceMappingURL=SchemaReference.js.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/SchemaReference.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.getTypeReference = exports.getEnumValueReference = exports.getArgumentReference = exports.getDirectiveReference = exports.getFieldReference = void 0; 4 | var graphql_1 = require("graphql"); 5 | function getFieldReference(typeInfo) { 6 | return { 7 | kind: 'Field', 8 | schema: typeInfo.schema, 9 | field: typeInfo.fieldDef, 10 | type: isMetaField(typeInfo.fieldDef) ? null : typeInfo.parentType, 11 | }; 12 | } 13 | exports.getFieldReference = getFieldReference; 14 | function getDirectiveReference(typeInfo) { 15 | return { 16 | kind: 'Directive', 17 | schema: typeInfo.schema, 18 | directive: typeInfo.directiveDef, 19 | }; 20 | } 21 | exports.getDirectiveReference = getDirectiveReference; 22 | function getArgumentReference(typeInfo) { 23 | return typeInfo.directiveDef 24 | ? { 25 | kind: 'Argument', 26 | schema: typeInfo.schema, 27 | argument: typeInfo.argDef, 28 | directive: typeInfo.directiveDef, 29 | } 30 | : { 31 | kind: 'Argument', 32 | schema: typeInfo.schema, 33 | argument: typeInfo.argDef, 34 | field: typeInfo.fieldDef, 35 | type: isMetaField(typeInfo.fieldDef) ? null : typeInfo.parentType, 36 | }; 37 | } 38 | exports.getArgumentReference = getArgumentReference; 39 | function getEnumValueReference(typeInfo) { 40 | return { 41 | kind: 'EnumValue', 42 | value: typeInfo.enumValue || undefined, 43 | type: typeInfo.inputType 44 | ? (0, graphql_1.getNamedType)(typeInfo.inputType) 45 | : undefined, 46 | }; 47 | } 48 | exports.getEnumValueReference = getEnumValueReference; 49 | function getTypeReference(typeInfo, type) { 50 | return { 51 | kind: 'Type', 52 | schema: typeInfo.schema, 53 | type: type || typeInfo.type, 54 | }; 55 | } 56 | exports.getTypeReference = getTypeReference; 57 | function isMetaField(fieldDef) { 58 | return fieldDef.name.slice(0, 2) === '__'; 59 | } 60 | //# sourceMappingURL=SchemaReference.js.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/SchemaReference.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"SchemaReference.js","sourceRoot":"","sources":["../src/utils/SchemaReference.ts"],"names":[],"mappings":";;;AASA,mCAAsD;AAuDtD,SAAgB,iBAAiB,CAAC,QAAa;IAC7C,OAAO;QACL,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,KAAK,EAAE,QAAQ,CAAC,QAAQ;QACxB,IAAI,EAAE,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU;KAClE,CAAC;AACJ,CAAC;AAPD,8CAOC;AAED,SAAgB,qBAAqB,CAAC,QAAa;IACjD,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,SAAS,EAAE,QAAQ,CAAC,YAAY;KACjC,CAAC;AACJ,CAAC;AAND,sDAMC;AAED,SAAgB,oBAAoB,CAAC,QAAa;IAChD,OAAO,QAAQ,CAAC,YAAY;QAC1B,CAAC,CAAC;YACE,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,QAAQ,EAAE,QAAQ,CAAC,MAAM;YACzB,SAAS,EAAE,QAAQ,CAAC,YAAY;SACjC;QACH,CAAC,CAAC;YACE,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,QAAQ,EAAE,QAAQ,CAAC,MAAM;YACzB,KAAK,EAAE,QAAQ,CAAC,QAAQ;YACxB,IAAI,EAAE,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU;SAClE,CAAC;AACR,CAAC;AAfD,oDAeC;AAED,SAAgB,qBAAqB,CAAC,QAAkB;IACtD,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,QAAQ,CAAC,SAAS,IAAI,SAAS;QAEtC,IAAI,EAAE,QAAQ,CAAC,SAAS;YACtB,CAAC,CAAE,IAAA,sBAAY,EAAC,QAAQ,CAAC,SAAS,CAAqB;YACvD,CAAC,CAAC,SAAS;KACd,CAAC;AACJ,CAAC;AATD,sDASC;AAID,SAAgB,gBAAgB,CAC9B,QAAa,EACb,IAA8B;IAE9B,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,IAAI,EAAE,IAAI,IAAI,QAAQ,CAAC,IAAI;KAC5B,CAAC;AACJ,CAAC;AATD,4CASC;AAED,SAAS,WAAW,CAAC,QAAgC;IACnD,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC;AAC5C,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/utils/collectVariables.d.ts: -------------------------------------------------------------------------------- 1 | import { DocumentNode, GraphQLSchema } from 'graphql'; 2 | export default function collectVariables(schema: GraphQLSchema, documentAST: DocumentNode): any; 3 | //# sourceMappingURL=collectVariables.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/collectVariables.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"collectVariables.d.ts","sourceRoot":"","sources":["../src/utils/collectVariables.ts"],"names":[],"mappings":"AASA,OAAO,EACL,YAAY,EACZ,aAAa,EAGd,MAAM,SAAS,CAAC;AAKjB,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,YAAY,OAiB1B"} -------------------------------------------------------------------------------- /codemirror-graphql/utils/collectVariables.esm.js: -------------------------------------------------------------------------------- 1 | import { typeFromAST, } from 'graphql'; 2 | export default function collectVariables(schema, documentAST) { 3 | const variableToType = Object.create(null); 4 | for (const definition of documentAST.definitions) { 5 | if (definition.kind === 'OperationDefinition') { 6 | const { variableDefinitions } = definition; 7 | if (variableDefinitions) { 8 | for (const { variable, type } of variableDefinitions) { 9 | const inputType = typeFromAST(schema, type); 10 | if (inputType) { 11 | variableToType[variable.name.value] = inputType; 12 | } 13 | } 14 | } 15 | } 16 | } 17 | return variableToType; 18 | } 19 | //# sourceMappingURL=collectVariables.js.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/collectVariables.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __values = (this && this.__values) || function(o) { 3 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; 4 | if (m) return m.call(o); 5 | if (o && typeof o.length === "number") return { 6 | next: function () { 7 | if (o && i >= o.length) o = void 0; 8 | return { value: o && o[i++], done: !o }; 9 | } 10 | }; 11 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 12 | }; 13 | Object.defineProperty(exports, "__esModule", { value: true }); 14 | var graphql_1 = require("graphql"); 15 | function collectVariables(schema, documentAST) { 16 | var e_1, _a, e_2, _b; 17 | var variableToType = Object.create(null); 18 | try { 19 | for (var _c = __values(documentAST.definitions), _d = _c.next(); !_d.done; _d = _c.next()) { 20 | var definition = _d.value; 21 | if (definition.kind === 'OperationDefinition') { 22 | var variableDefinitions = definition.variableDefinitions; 23 | if (variableDefinitions) { 24 | try { 25 | for (var variableDefinitions_1 = (e_2 = void 0, __values(variableDefinitions)), variableDefinitions_1_1 = variableDefinitions_1.next(); !variableDefinitions_1_1.done; variableDefinitions_1_1 = variableDefinitions_1.next()) { 26 | var _e = variableDefinitions_1_1.value, variable = _e.variable, type = _e.type; 27 | var inputType = (0, graphql_1.typeFromAST)(schema, type); 28 | if (inputType) { 29 | variableToType[variable.name.value] = inputType; 30 | } 31 | } 32 | } 33 | catch (e_2_1) { e_2 = { error: e_2_1 }; } 34 | finally { 35 | try { 36 | if (variableDefinitions_1_1 && !variableDefinitions_1_1.done && (_b = variableDefinitions_1.return)) _b.call(variableDefinitions_1); 37 | } 38 | finally { if (e_2) throw e_2.error; } 39 | } 40 | } 41 | } 42 | } 43 | } 44 | catch (e_1_1) { e_1 = { error: e_1_1 }; } 45 | finally { 46 | try { 47 | if (_d && !_d.done && (_a = _c.return)) _a.call(_c); 48 | } 49 | finally { if (e_1) throw e_1.error; } 50 | } 51 | return variableToType; 52 | } 53 | exports.default = collectVariables; 54 | //# sourceMappingURL=collectVariables.js.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/collectVariables.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"collectVariables.js","sourceRoot":"","sources":["../src/utils/collectVariables.ts"],"names":[],"mappings":";;;;;;;;;;;;;AASA,mCAKiB;AAKjB,SAAwB,gBAAgB,CACtC,MAAqB,EACrB,WAAyB;;IAEzB,IAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;;QAC3C,KAAyB,IAAA,KAAA,SAAA,WAAW,CAAC,WAAW,CAAA,gBAAA,4BAAE;YAA7C,IAAM,UAAU,WAAA;YACnB,IAAI,UAAU,CAAC,IAAI,KAAK,qBAAqB,EAAE;gBACrC,IAAA,mBAAmB,GAAK,UAAU,oBAAf,CAAgB;gBAC3C,IAAI,mBAAmB,EAAE;;wBACvB,KAAiC,IAAA,uCAAA,SAAA,mBAAmB,CAAA,CAAA,wDAAA,yFAAE;4BAA3C,IAAA,kCAAkB,EAAhB,QAAQ,cAAA,EAAE,IAAI,UAAA;4BACzB,IAAM,SAAS,GAAG,IAAA,qBAAW,EAAC,MAAM,EAAE,IAAqB,CAAC,CAAC;4BAC7D,IAAI,SAAS,EAAE;gCACb,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;6BACjD;yBACF;;;;;;;;;iBACF;aACF;SACF;;;;;;;;;IACD,OAAO,cAAc,CAAC;AACxB,CAAC;AAnBD,mCAmBC"} -------------------------------------------------------------------------------- /codemirror-graphql/utils/forEachState.d.ts: -------------------------------------------------------------------------------- 1 | import type { State } from 'graphql-language-service'; 2 | export default function forEachState(stack: State, fn: (state: State) => void): void; 3 | //# sourceMappingURL=forEachState.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/forEachState.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"forEachState.d.ts","sourceRoot":"","sources":["../src/utils/forEachState.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,KAAK,EAAS,MAAM,0BAA0B,CAAC;AAG7D,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,QAU5E"} -------------------------------------------------------------------------------- /codemirror-graphql/utils/forEachState.esm.js: -------------------------------------------------------------------------------- 1 | export default function forEachState(stack, fn) { 2 | const reverseStateStack = []; 3 | let state = stack; 4 | while (state === null || state === void 0 ? void 0 : state.kind) { 5 | reverseStateStack.push(state); 6 | state = state.prevState; 7 | } 8 | for (let i = reverseStateStack.length - 1; i >= 0; i--) { 9 | fn(reverseStateStack[i]); 10 | } 11 | } 12 | //# sourceMappingURL=forEachState.js.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/forEachState.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | function forEachState(stack, fn) { 4 | var reverseStateStack = []; 5 | var state = stack; 6 | while (state === null || state === void 0 ? void 0 : state.kind) { 7 | reverseStateStack.push(state); 8 | state = state.prevState; 9 | } 10 | for (var i = reverseStateStack.length - 1; i >= 0; i--) { 11 | fn(reverseStateStack[i]); 12 | } 13 | } 14 | exports.default = forEachState; 15 | //# sourceMappingURL=forEachState.js.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/forEachState.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"forEachState.js","sourceRoot":"","sources":["../src/utils/forEachState.ts"],"names":[],"mappings":";;AAYA,SAAwB,YAAY,CAAC,KAAY,EAAE,EAA0B;IAC3E,IAAM,iBAAiB,GAAG,EAAE,CAAC;IAC7B,IAAI,KAAK,GAAiB,KAAK,CAAC;IAChC,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,EAAE;QAClB,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9B,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC;KACzB;IACD,KAAK,IAAI,CAAC,GAAG,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QACtD,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;KAC1B;AACH,CAAC;AAVD,+BAUC"} -------------------------------------------------------------------------------- /codemirror-graphql/utils/getTypeInfo.d.ts: -------------------------------------------------------------------------------- 1 | import { GraphQLSchema, GraphQLType, GraphQLField, GraphQLDirective, GraphQLArgument, GraphQLInputType, GraphQLEnumValue, GraphQLInputFieldMap } from 'graphql'; 2 | import type { State, Maybe } from 'graphql-language-service'; 3 | export interface TypeInfo { 4 | schema: GraphQLSchema; 5 | type?: Maybe; 6 | parentType?: Maybe; 7 | inputType?: Maybe; 8 | directiveDef?: Maybe; 9 | fieldDef?: Maybe>; 10 | argDef?: Maybe; 11 | argDefs?: Maybe; 12 | enumValue?: Maybe; 13 | objectFieldDefs?: Maybe; 14 | } 15 | export default function getTypeInfo(schema: GraphQLSchema, tokenState: State): TypeInfo; 16 | //# sourceMappingURL=getTypeInfo.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/getTypeInfo.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"getTypeInfo.d.ts","sourceRoot":"","sources":["../src/utils/getTypeInfo.ts"],"names":[],"mappings":"AASA,OAAO,EAOL,aAAa,EACb,WAAW,EAEX,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAU7D,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAC1B,UAAU,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACpC,YAAY,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IACzC,MAAM,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,KAAK,CAAC,eAAe,EAAE,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACpC,eAAe,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;CAC/C;AAMD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,YA4G3E"} -------------------------------------------------------------------------------- /codemirror-graphql/utils/hintList.d.ts: -------------------------------------------------------------------------------- 1 | import type CodeMirror from 'codemirror'; 2 | import { IHint, IHints } from '../hint'; 3 | export default function hintList(cursor: CodeMirror.Position, token: CodeMirror.Token, list: IHint[]): IHints | undefined; 4 | //# sourceMappingURL=hintList.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/hintList.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"hintList.d.ts","sourceRoot":"","sources":["../src/utils/hintList.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGxC,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,MAAM,EAAE,UAAU,CAAC,QAAQ,EAC3B,KAAK,EAAE,UAAU,CAAC,KAAK,EACvB,IAAI,EAAE,KAAK,EAAE,GACZ,MAAM,GAAG,SAAS,CAgBpB"} -------------------------------------------------------------------------------- /codemirror-graphql/utils/hintList.esm.js: -------------------------------------------------------------------------------- 1 | export default function hintList(cursor, token, list) { 2 | const hints = filterAndSortList(list, normalizeText(token.string)); 3 | if (!hints) { 4 | return; 5 | } 6 | const tokenStart = token.type !== null && /"|\w/.test(token.string[0]) 7 | ? token.start 8 | : token.end; 9 | return { 10 | list: hints, 11 | from: { line: cursor.line, ch: tokenStart }, 12 | to: { line: cursor.line, ch: token.end }, 13 | }; 14 | } 15 | function filterAndSortList(list, text) { 16 | if (!text) { 17 | return filterNonEmpty(list, entry => !entry.isDeprecated); 18 | } 19 | const byProximity = list.map(entry => ({ 20 | proximity: getProximity(normalizeText(entry.text), text), 21 | entry, 22 | })); 23 | const conciseMatches = filterNonEmpty(filterNonEmpty(byProximity, pair => pair.proximity <= 2), pair => !pair.entry.isDeprecated); 24 | const sortedMatches = conciseMatches.sort((a, b) => (a.entry.isDeprecated ? 1 : 0) - (b.entry.isDeprecated ? 1 : 0) || 25 | a.proximity - b.proximity || 26 | a.entry.text.length - b.entry.text.length); 27 | return sortedMatches.map(pair => pair.entry); 28 | } 29 | function filterNonEmpty(array, predicate) { 30 | const filtered = array.filter(predicate); 31 | return filtered.length === 0 ? array : filtered; 32 | } 33 | function normalizeText(text) { 34 | return text.toLowerCase().replaceAll(/\W/g, ''); 35 | } 36 | function getProximity(suggestion, text) { 37 | let proximity = lexicalDistance(text, suggestion); 38 | if (suggestion.length > text.length) { 39 | proximity -= suggestion.length - text.length - 1; 40 | proximity += suggestion.indexOf(text) === 0 ? 0 : 0.5; 41 | } 42 | return proximity; 43 | } 44 | function lexicalDistance(a, b) { 45 | let i; 46 | let j; 47 | const d = []; 48 | const aLength = a.length; 49 | const bLength = b.length; 50 | for (i = 0; i <= aLength; i++) { 51 | d[i] = [i]; 52 | } 53 | for (j = 1; j <= bLength; j++) { 54 | d[0][j] = j; 55 | } 56 | for (i = 1; i <= aLength; i++) { 57 | for (j = 1; j <= bLength; j++) { 58 | const cost = a[i - 1] === b[j - 1] ? 0 : 1; 59 | d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost); 60 | if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) { 61 | d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + cost); 62 | } 63 | } 64 | } 65 | return d[aLength][bLength]; 66 | } 67 | //# sourceMappingURL=hintList.js.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/hintList.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | function hintList(cursor, token, list) { 4 | var hints = filterAndSortList(list, normalizeText(token.string)); 5 | if (!hints) { 6 | return; 7 | } 8 | var tokenStart = token.type !== null && /"|\w/.test(token.string[0]) 9 | ? token.start 10 | : token.end; 11 | return { 12 | list: hints, 13 | from: { line: cursor.line, ch: tokenStart }, 14 | to: { line: cursor.line, ch: token.end }, 15 | }; 16 | } 17 | exports.default = hintList; 18 | function filterAndSortList(list, text) { 19 | if (!text) { 20 | return filterNonEmpty(list, function (entry) { return !entry.isDeprecated; }); 21 | } 22 | var byProximity = list.map(function (entry) { return ({ 23 | proximity: getProximity(normalizeText(entry.text), text), 24 | entry: entry, 25 | }); }); 26 | var conciseMatches = filterNonEmpty(filterNonEmpty(byProximity, function (pair) { return pair.proximity <= 2; }), function (pair) { return !pair.entry.isDeprecated; }); 27 | var sortedMatches = conciseMatches.sort(function (a, b) { 28 | return (a.entry.isDeprecated ? 1 : 0) - (b.entry.isDeprecated ? 1 : 0) || 29 | a.proximity - b.proximity || 30 | a.entry.text.length - b.entry.text.length; 31 | }); 32 | return sortedMatches.map(function (pair) { return pair.entry; }); 33 | } 34 | function filterNonEmpty(array, predicate) { 35 | var filtered = array.filter(predicate); 36 | return filtered.length === 0 ? array : filtered; 37 | } 38 | function normalizeText(text) { 39 | return text.toLowerCase().replaceAll(/\W/g, ''); 40 | } 41 | function getProximity(suggestion, text) { 42 | var proximity = lexicalDistance(text, suggestion); 43 | if (suggestion.length > text.length) { 44 | proximity -= suggestion.length - text.length - 1; 45 | proximity += suggestion.indexOf(text) === 0 ? 0 : 0.5; 46 | } 47 | return proximity; 48 | } 49 | function lexicalDistance(a, b) { 50 | var i; 51 | var j; 52 | var d = []; 53 | var aLength = a.length; 54 | var bLength = b.length; 55 | for (i = 0; i <= aLength; i++) { 56 | d[i] = [i]; 57 | } 58 | for (j = 1; j <= bLength; j++) { 59 | d[0][j] = j; 60 | } 61 | for (i = 1; i <= aLength; i++) { 62 | for (j = 1; j <= bLength; j++) { 63 | var cost = a[i - 1] === b[j - 1] ? 0 : 1; 64 | d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost); 65 | if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) { 66 | d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + cost); 67 | } 68 | } 69 | } 70 | return d[aLength][bLength]; 71 | } 72 | //# sourceMappingURL=hintList.js.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/hintList.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"hintList.js","sourceRoot":"","sources":["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,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CACvB,CAAC;YAEF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE;gBACpE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;aACrD;SACF;KACF;IAED,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/utils/info-addon.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=info-addon.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/info-addon.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"info-addon.d.ts","sourceRoot":"","sources":["../src/utils/info-addon.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /codemirror-graphql/utils/jsonParse.d.ts: -------------------------------------------------------------------------------- 1 | export default function jsonParse(str: string): ParseObjectOutput; 2 | interface BaseParseOutput { 3 | kind: string; 4 | start: number; 5 | end: number; 6 | } 7 | export interface ParseTokenOutput extends BaseParseOutput { 8 | value: any; 9 | } 10 | export interface ParseObjectOutput extends BaseParseOutput { 11 | kind: 'Object'; 12 | members: ParseMemberOutput[]; 13 | } 14 | export interface ParseArrayOutput extends BaseParseOutput { 15 | kind: 'Array'; 16 | values?: ParseValueOutput[]; 17 | } 18 | export interface ParseMemberOutput extends BaseParseOutput { 19 | key: ParseTokenOutput | null; 20 | value?: ParseValueOutput; 21 | } 22 | export declare type ParseValueOutput = ParseTokenOutput | ParseObjectOutput | ParseArrayOutput | undefined; 23 | declare type SyntaxErrorPosition = { 24 | start: number; 25 | end: number; 26 | }; 27 | export declare class JSONSyntaxError extends Error { 28 | readonly position: SyntaxErrorPosition; 29 | constructor(message: string, position: SyntaxErrorPosition); 30 | } 31 | export {}; 32 | //# sourceMappingURL=jsonParse.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/jsonParse.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"jsonParse.d.ts","sourceRoot":"","sources":["../src/utils/jsonParse.ts"],"names":[],"mappings":"AAqBA,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,GAAG,EAAE,MAAM,qBAS5C;AAUD,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AACD,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,KAAK,EAAE,GAAG,CAAC;CACZ;AACD,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AACD,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC7B;AACD,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC7B,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B;AACD,oBAAY,gBAAgB,GACxB,gBAAgB,GAChB,iBAAiB,GACjB,gBAAgB,GAChB,SAAS,CAAC;AA6Fd,aAAK,mBAAmB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1D,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;gBAC3B,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB;CAI3D"} -------------------------------------------------------------------------------- /codemirror-graphql/utils/jump-addon.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=jump-addon.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/jump-addon.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"jump-addon.d.ts","sourceRoot":"","sources":["../src/utils/jump-addon.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /codemirror-graphql/utils/mode-factory.d.ts: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | declare const graphqlModeFactory: CodeMirror.ModeFactory; 3 | export default graphqlModeFactory; 4 | //# sourceMappingURL=mode-factory.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/mode-factory.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode-factory.d.ts","sourceRoot":"","sources":["../src/utils/mode-factory.ts"],"names":[],"mappings":"AASA,OAAO,UAAU,MAAM,YAAY,CAAC;AA6BpC,QAAA,MAAM,kBAAkB,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,CAuBnD,CAAC;AAEF,eAAe,kBAAkB,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/utils/mode-factory.esm.js: -------------------------------------------------------------------------------- 1 | import { LexRules, ParseRules, isIgnored, onlineParser, } from 'graphql-language-service'; 2 | import indent from './mode-indent'; 3 | const graphqlModeFactory = config => { 4 | const parser = onlineParser({ 5 | eatWhitespace: stream => stream.eatWhile(isIgnored), 6 | lexRules: LexRules, 7 | parseRules: ParseRules, 8 | editorConfig: { tabSize: config.tabSize }, 9 | }); 10 | return { 11 | config, 12 | startState: parser.startState, 13 | token: parser.token, 14 | indent, 15 | electricInput: /^\s*[})\]]/, 16 | fold: 'brace', 17 | lineComment: '#', 18 | closeBrackets: { 19 | pairs: '()[]{}""', 20 | explode: '()[]{}', 21 | }, 22 | }; 23 | }; 24 | export default graphqlModeFactory; 25 | //# sourceMappingURL=mode-factory.js.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/mode-factory.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __importDefault = (this && this.__importDefault) || function (mod) { 3 | return (mod && mod.__esModule) ? mod : { "default": mod }; 4 | }; 5 | Object.defineProperty(exports, "__esModule", { value: true }); 6 | var graphql_language_service_1 = require("graphql-language-service"); 7 | var mode_indent_1 = __importDefault(require("./mode-indent")); 8 | var graphqlModeFactory = function (config) { 9 | var parser = (0, graphql_language_service_1.onlineParser)({ 10 | eatWhitespace: function (stream) { return stream.eatWhile(graphql_language_service_1.isIgnored); }, 11 | lexRules: graphql_language_service_1.LexRules, 12 | parseRules: graphql_language_service_1.ParseRules, 13 | editorConfig: { tabSize: config.tabSize }, 14 | }); 15 | return { 16 | config: config, 17 | startState: parser.startState, 18 | token: parser.token, 19 | indent: mode_indent_1.default, 20 | electricInput: /^\s*[})\]]/, 21 | fold: 'brace', 22 | lineComment: '#', 23 | closeBrackets: { 24 | pairs: '()[]{}""', 25 | explode: '()[]{}', 26 | }, 27 | }; 28 | }; 29 | exports.default = graphqlModeFactory; 30 | //# sourceMappingURL=mode-factory.js.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/mode-factory.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode-factory.js","sourceRoot":"","sources":["../src/utils/mode-factory.ts"],"names":[],"mappings":";;;;;AAUA,qEAKkC;AAClC,8DAAmC;AAsBnC,IAAM,kBAAkB,GAAgC,UAAA,MAAM;IAC5D,IAAM,MAAM,GAAG,IAAA,uCAAY,EAAC;QAC1B,aAAa,EAAE,UAAA,MAAM,IAAI,OAAA,MAAM,CAAC,QAAQ,CAAC,oCAAS,CAAC,EAA1B,CAA0B;QACnD,QAAQ,EAAE,mCAAQ;QAClB,UAAU,EAAE,qCAAU;QACtB,YAAY,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE;KAC1C,CAAC,CAAC;IAEH,OAAO;QACL,MAAM,QAAA;QACN,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,KAAK,EAAE,MAAM,CAAC,KAEb;QACD,MAAM,uBAAA;QACN,aAAa,EAAE,YAAY;QAC3B,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,GAAG;QAChB,aAAa,EAAE;YACb,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,QAAQ;SAClB;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC"} -------------------------------------------------------------------------------- /codemirror-graphql/utils/mode-indent.d.ts: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | import { State } from 'graphql-language-service'; 3 | export default function indent(this: CodeMirror.Mode & { 4 | electricInput?: RegExp; 5 | config?: CodeMirror.EditorConfiguration; 6 | }, state: State, textAfter: string): number; 7 | //# sourceMappingURL=mode-indent.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/mode-indent.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode-indent.d.ts","sourceRoot":"","sources":["../src/utils/mode-indent.ts"],"names":[],"mappings":"AASA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAGjD,MAAM,CAAC,OAAO,UAAU,MAAM,CAC5B,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,UAAU,CAAC,mBAAmB,CAAC;CACzC,EACD,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,MAAM,UAUlB"} -------------------------------------------------------------------------------- /codemirror-graphql/utils/mode-indent.esm.js: -------------------------------------------------------------------------------- 1 | export default function indent(state, textAfter) { 2 | var _a, _b; 3 | const { levels, indentLevel } = state; 4 | const level = !levels || levels.length === 0 5 | ? indentLevel 6 | : levels.at(-1) - (((_a = this.electricInput) === null || _a === void 0 ? void 0 : _a.test(textAfter)) ? 1 : 0); 7 | return (level || 0) * (((_b = this.config) === null || _b === void 0 ? void 0 : _b.indentUnit) || 0); 8 | } 9 | //# sourceMappingURL=mode-indent.js.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/mode-indent.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | function indent(state, textAfter) { 4 | var _a, _b; 5 | var levels = state.levels, indentLevel = state.indentLevel; 6 | var level = !levels || levels.length === 0 7 | ? indentLevel 8 | : levels.at(-1) - (((_a = this.electricInput) === null || _a === void 0 ? void 0 : _a.test(textAfter)) ? 1 : 0); 9 | return (level || 0) * (((_b = this.config) === null || _b === void 0 ? void 0 : _b.indentUnit) || 0); 10 | } 11 | exports.default = indent; 12 | //# sourceMappingURL=mode-indent.js.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/mode-indent.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode-indent.js","sourceRoot":"","sources":["../src/utils/mode-indent.ts"],"names":[],"mappings":";;AAaA,SAAwB,MAAM,CAK5B,KAAY,EACZ,SAAiB;;IAET,IAAA,MAAM,GAAkB,KAAK,OAAvB,EAAE,WAAW,GAAK,KAAK,YAAV,CAAW;IAGtC,IAAM,KAAK,GACT,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAC5B,CAAC,CAAC,WAAW;QACb,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,GAAG,CAAC,CAAA,MAAA,IAAI,CAAC,aAAa,0CAAE,IAAI,CAAC,SAAS,CAAC,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrE,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,UAAU,KAAI,CAAC,CAAC,CAAC;AACvD,CAAC;AAhBD,yBAgBC"} -------------------------------------------------------------------------------- /codemirror-graphql/utils/runParser.d.ts: -------------------------------------------------------------------------------- 1 | import { CharacterStream, ParserOptions, State } from 'graphql-language-service'; 2 | export default function runParser(sourceText: string, parserOptions: ParserOptions, callbackFn: (stream: CharacterStream, state: State, style: string) => void): void; 3 | //# sourceMappingURL=runParser.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/runParser.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"runParser.d.ts","sourceRoot":"","sources":["../src/utils/runParser.ts"],"names":[],"mappings":"AASA,OAAO,EACL,eAAe,EAEf,aAAa,EACb,KAAK,EACN,MAAM,0BAA0B,CAAC;AAElC,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,QAa3E"} -------------------------------------------------------------------------------- /codemirror-graphql/utils/runParser.esm.js: -------------------------------------------------------------------------------- 1 | import { CharacterStream, onlineParser, } from 'graphql-language-service'; 2 | export default function runParser(sourceText, parserOptions, callbackFn) { 3 | const parser = onlineParser(parserOptions); 4 | const state = parser.startState(); 5 | const lines = sourceText.split('\n'); 6 | for (const line of lines) { 7 | const stream = new CharacterStream(line); 8 | while (!stream.eol()) { 9 | const style = parser.token(stream, state); 10 | callbackFn(stream, state, style); 11 | } 12 | } 13 | } 14 | //# sourceMappingURL=runParser.js.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/runParser.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __values = (this && this.__values) || function(o) { 3 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; 4 | if (m) return m.call(o); 5 | if (o && typeof o.length === "number") return { 6 | next: function () { 7 | if (o && i >= o.length) o = void 0; 8 | return { value: o && o[i++], done: !o }; 9 | } 10 | }; 11 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 12 | }; 13 | Object.defineProperty(exports, "__esModule", { value: true }); 14 | var graphql_language_service_1 = require("graphql-language-service"); 15 | function runParser(sourceText, parserOptions, callbackFn) { 16 | var e_1, _a; 17 | var parser = (0, graphql_language_service_1.onlineParser)(parserOptions); 18 | var state = parser.startState(); 19 | var lines = sourceText.split('\n'); 20 | try { 21 | for (var lines_1 = __values(lines), lines_1_1 = lines_1.next(); !lines_1_1.done; lines_1_1 = lines_1.next()) { 22 | var line = lines_1_1.value; 23 | var stream = new graphql_language_service_1.CharacterStream(line); 24 | while (!stream.eol()) { 25 | var style = parser.token(stream, state); 26 | callbackFn(stream, state, style); 27 | } 28 | } 29 | } 30 | catch (e_1_1) { e_1 = { error: e_1_1 }; } 31 | finally { 32 | try { 33 | if (lines_1_1 && !lines_1_1.done && (_a = lines_1.return)) _a.call(lines_1); 34 | } 35 | finally { if (e_1) throw e_1.error; } 36 | } 37 | } 38 | exports.default = runParser; 39 | //# sourceMappingURL=runParser.js.map -------------------------------------------------------------------------------- /codemirror-graphql/utils/runParser.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"runParser.js","sourceRoot":"","sources":["../src/utils/runParser.ts"],"names":[],"mappings":";;;;;;;;;;;;;AASA,qEAKkC;AAElC,SAAwB,SAAS,CAC/B,UAAkB,EAClB,aAA4B,EAC5B,UAA0E;;IAE1E,IAAM,MAAM,GAAG,IAAA,uCAAY,EAAC,aAAa,CAAC,CAAC;IAC3C,IAAM,KAAK,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IAClC,IAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;;QAErC,KAAmB,IAAA,UAAA,SAAA,KAAK,CAAA,4BAAA,+CAAE;YAArB,IAAM,IAAI,kBAAA;YACb,IAAM,MAAM,GAAG,IAAI,0CAAe,CAAC,IAAI,CAAC,CAAC;YACzC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE;gBACpB,IAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;gBAC1C,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;aAClC;SACF;;;;;;;;;AACH,CAAC;AAhBD,4BAgBC"} -------------------------------------------------------------------------------- /codemirror-graphql/variables/hint.d.ts: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | import { GraphQLInputType } from 'graphql'; 3 | import { IHints } from '../hint'; 4 | export declare type VariableToType = Record; 5 | interface GraphQLVariableHintOptions { 6 | variableToType: VariableToType; 7 | } 8 | declare module 'codemirror' { 9 | interface ShowHintOptions { 10 | variableToType?: VariableToType; 11 | } 12 | interface CodeMirrorHintMap { 13 | 'graphql-variables': (editor: CodeMirror.Editor, options: GraphQLVariableHintOptions) => IHints | undefined; 14 | } 15 | } 16 | export {}; 17 | //# sourceMappingURL=hint.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/variables/hint.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"hint.d.ts","sourceRoot":"","sources":["../src/variables/hint.ts"],"names":[],"mappings":"AASA,OAAO,UAAqB,MAAM,YAAY,CAAC;AAC/C,OAAO,EAOL,gBAAgB,EAEjB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAKjC,oBAAY,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAC9D,UAAU,0BAA0B;IAClC,cAAc,EAAE,cAAc,CAAC;CAChC;AAED,OAAO,QAAQ,YAAY,CAAC;IAC1B,UAAU,eAAe;QACvB,cAAc,CAAC,EAAE,cAAc,CAAC;KACjC;IAED,UAAU,iBAAiB;QACzB,mBAAmB,EAAE,CACnB,MAAM,EAAE,UAAU,CAAC,MAAM,EACzB,OAAO,EAAE,0BAA0B,KAChC,MAAM,GAAG,SAAS,CAAC;KACzB;CACF"} -------------------------------------------------------------------------------- /codemirror-graphql/variables/lint.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=lint.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/variables/lint.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../src/variables/lint.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /codemirror-graphql/variables/mode.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=mode.d.ts.map -------------------------------------------------------------------------------- /codemirror-graphql/variables/mode.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode.d.ts","sourceRoot":"","sources":["../src/variables/mode.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /codemirror-graphql/variables/mode.esm.js: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | import { list, t, onlineParser, opt, p, } from 'graphql-language-service'; 3 | import indent from '../utils/mode-indent'; 4 | CodeMirror.defineMode('graphql-variables', config => { 5 | const parser = onlineParser({ 6 | eatWhitespace: stream => stream.eatSpace(), 7 | lexRules: LexRules, 8 | parseRules: ParseRules, 9 | editorConfig: { tabSize: config.tabSize }, 10 | }); 11 | return { 12 | config, 13 | startState: parser.startState, 14 | token: parser.token, 15 | indent, 16 | electricInput: /^\s*[}\]]/, 17 | fold: 'brace', 18 | closeBrackets: { 19 | pairs: '[]{}""', 20 | explode: '[]{}', 21 | }, 22 | }; 23 | }); 24 | const LexRules = { 25 | Punctuation: /^\[|]|\{|\}|:|,/, 26 | Number: /^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/, 27 | String: /^"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?/, 28 | Keyword: /^true|false|null/, 29 | }; 30 | const ParseRules = { 31 | Document: [p('{'), list('Variable', opt(p(','))), p('}')], 32 | Variable: [namedKey('variable'), p(':'), 'Value'], 33 | Value(token) { 34 | switch (token.kind) { 35 | case 'Number': 36 | return 'NumberValue'; 37 | case 'String': 38 | return 'StringValue'; 39 | case 'Punctuation': 40 | switch (token.value) { 41 | case '[': 42 | return 'ListValue'; 43 | case '{': 44 | return 'ObjectValue'; 45 | } 46 | return null; 47 | case 'Keyword': 48 | switch (token.value) { 49 | case 'true': 50 | case 'false': 51 | return 'BooleanValue'; 52 | case 'null': 53 | return 'NullValue'; 54 | } 55 | return null; 56 | } 57 | }, 58 | NumberValue: [t('Number', 'number')], 59 | StringValue: [t('String', 'string')], 60 | BooleanValue: [t('Keyword', 'builtin')], 61 | NullValue: [t('Keyword', 'keyword')], 62 | ListValue: [p('['), list('Value', opt(p(','))), p(']')], 63 | ObjectValue: [p('{'), list('ObjectField', opt(p(','))), p('}')], 64 | ObjectField: [namedKey('attribute'), p(':'), 'Value'], 65 | }; 66 | function namedKey(style) { 67 | return { 68 | style, 69 | match: (token) => token.kind === 'String', 70 | update(state, token) { 71 | state.name = token.value.slice(1, -1); 72 | }, 73 | }; 74 | } 75 | //# sourceMappingURL=mode.js.map -------------------------------------------------------------------------------- /codemirror-graphql/variables/mode.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mode.js","sourceRoot":"","sources":["../src/variables/mode.ts"],"names":[],"mappings":";;;;;AASA,0DAAoC;AAEpC,qEAQkC;AAClC,qEAA0C;AAM1C,oBAAU,CAAC,UAAU,CAAC,mBAAmB,EAAE,UAAA,MAAM;IAC/C,IAAM,MAAM,GAAG,IAAA,uCAAY,EAAC;QAC1B,aAAa,EAAE,UAAA,MAAM,IAAI,OAAA,MAAM,CAAC,QAAQ,EAAE,EAAjB,CAAiB;QAC1C,QAAQ,EAAE,QAAQ;QAClB,UAAU,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AAE,CAAC,CAAC,CAAC,CAAC;QACxC,CAAC;KACF,CAAC;AACJ,CAAC"} -------------------------------------------------------------------------------- /docker-compose-local.yml: -------------------------------------------------------------------------------- 1 | name: tradenote 2 | services: 3 | tradenote: 4 | container_name: tradenote_app 5 | hostname: tradenote_app 6 | build: 7 | context: . 8 | dockerfile: ./docker/Dockerfile 9 | image: tradenote:latest 10 | ports: 11 | - 8080:8080 12 | links: 13 | - mongo 14 | environment: 15 | MONGO_URI: mongodb://tradenote:tradenote@mongo:27017/tradenote?authSource=admin 16 | TRADENOTE_DATABASE: tradenote 17 | APP_ID: 123456 18 | MASTER_KEY: 123456 19 | TRADENOTE_PORT: 8080 20 | mongo: 21 | image: mongo:latest 22 | container_name: tradenote_db 23 | volumes: 24 | - tradenote_db:/data/db 25 | ports: 26 | - 27017:27017 27 | environment: 28 | MONGO_INITDB_ROOT_USERNAME: tradenote 29 | MONGO_INITDB_ROOT_PASSWORD: tradenote 30 | MONGO_INITDB_DATABASE: tradenote 31 | volumes: 32 | tradenote_db: 33 | name: tradenote_db 34 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | name: tradenote 2 | services: 3 | tradenote: 4 | image: eleventrading/tradenote 5 | container_name: tradenote_app 6 | ports: 7 | - 8080:8080 8 | environment: 9 | MONGO_URI: mongodb://tradenote:tradenote@mongo:27017/tradenote?authSource=admin 10 | TRADENOTE_DATABASE: tradenote 11 | APP_ID: 123456 12 | MASTER_KEY: 123456 13 | TRADENOTE_PORT: 8080 14 | networks: 15 | - tradenote_net 16 | mongo: 17 | image: mongo:latest 18 | container_name: tradenote_db 19 | volumes: 20 | - tradenote_db:/data/db 21 | ports: 22 | - 27017:27017 23 | environment: 24 | MONGO_INITDB_ROOT_USERNAME: tradenote 25 | MONGO_INITDB_ROOT_PASSWORD: tradenote 26 | MONGO_INITDB_DATABASE: tradenote 27 | networks: 28 | - tradenote_net 29 | networks: 30 | tradenote_net: 31 | driver: bridge 32 | 33 | volumes: 34 | tradenote_db: 35 | name: tradenote_db -------------------------------------------------------------------------------- /docker/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | package-lock.json 3 | dist 4 | .git 5 | .vscode 6 | logs -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | # Using 18 alpine because supports arm/v8 and arm/v8 needed for silicon chips 2 | FROM node:18-alpine 3 | RUN apk add --no-cache bash 4 | WORKDIR /app 5 | ADD ./ . 6 | RUN npm install 7 | RUN npm run build 8 | CMD ["npm", "start"] -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tradenote", 3 | "version": "19.0.3", 4 | "description": "TradeNote helps traders store, discover and recollect trade patterns so they can become and remain consistent and profitable traders", 5 | "author": "eleven.trading", 6 | "license": "GPL-3.0-or-later", 7 | "type": "module", 8 | "scripts": { 9 | "start": "node index.mjs", 10 | "build": "vite build", 11 | "preview": "vite preview" 12 | }, 13 | "dependencies": { 14 | "@stripe/stripe-js": "^5.2.0", 15 | "axios": "^1.7.5", 16 | "calendarize": "^1.1.1", 17 | "dayjs": "^1.11.13", 18 | "echarts": "^5.5.1", 19 | "express": "^4.19.2", 20 | "http-proxy": "^1.18.1", 21 | "http-proxy-middleware": "^3.0.3", 22 | "lodash": "^4.17.21", 23 | "markerjs2": "^2.32.1", 24 | "mongodb": "^6.8.0", 25 | "papaparse": "^5.4.1", 26 | "parse": "^5.3.0", 27 | "parse-dashboard": "^5.4.0", 28 | "parse-server": "^7.2.0", 29 | "pinia": "^2.2.2", 30 | "posthog-js": "^1.157.2", 31 | "quill": "^2.0.2", 32 | "shepherd.js": "^13.0.3", 33 | "sortablejs": "^1.15.2", 34 | "stripe": "^17.4.0", 35 | "vue": "^3.4.38", 36 | "vue-router": "^4.4.3", 37 | "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz" 38 | }, 39 | "devDependencies": { 40 | "@vitejs/plugin-vue": "^5.1.2", 41 | "vite": "^5.4.2" 42 | }, 43 | "main": "index.mjs" 44 | } 45 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 3 | 8 | -------------------------------------------------------------------------------- /src/assets/astronaut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eleven-Trading/TradeNote/56eb096631f95c1cdf5d9ef416e7d0115c56465e/src/assets/astronaut.png -------------------------------------------------------------------------------- /src/assets/base.css: -------------------------------------------------------------------------------- 1 | /* color palette from */ 2 | :root { 3 | --vt-c-white: #ffffff; 4 | --vt-c-white-soft: #f8f8f8; 5 | --vt-c-white-mute: #f2f2f2; 6 | 7 | --vt-c-black: #181818; 8 | --vt-c-black-soft: #222222; 9 | --vt-c-black-mute: #282828; 10 | 11 | --vt-c-indigo: #2c3e50; 12 | 13 | --vt-c-divider-light-1: rgba(60, 60, 60, 0.29); 14 | --vt-c-divider-light-2: rgba(60, 60, 60, 0.12); 15 | --vt-c-divider-dark-1: rgba(84, 84, 84, 0.65); 16 | --vt-c-divider-dark-2: rgba(84, 84, 84, 0.48); 17 | 18 | --vt-c-text-light-1: var(--vt-c-indigo); 19 | --vt-c-text-light-2: rgba(60, 60, 60, 0.66); 20 | --vt-c-text-dark-1: var(--vt-c-white); 21 | --vt-c-text-dark-2: rgba(235, 235, 235, 0.64); 22 | } 23 | 24 | /* semantic color variables for this project */ 25 | :root { 26 | --color-background: var(--vt-c-white); 27 | --color-background-soft: var(--vt-c-white-soft); 28 | --color-background-mute: var(--vt-c-white-mute); 29 | 30 | --color-border: var(--vt-c-divider-light-2); 31 | --color-border-hover: var(--vt-c-divider-light-1); 32 | 33 | --color-heading: var(--vt-c-text-light-1); 34 | --color-text: var(--vt-c-text-light-1); 35 | 36 | --section-gap: 160px; 37 | } 38 | 39 | @media (prefers-color-scheme: dark) { 40 | :root { 41 | --color-background: var(--vt-c-black); 42 | --color-background-soft: var(--vt-c-black-soft); 43 | --color-background-mute: var(--vt-c-black-mute); 44 | 45 | --color-border: var(--vt-c-divider-dark-2); 46 | --color-border-hover: var(--vt-c-divider-dark-1); 47 | 48 | --color-heading: var(--vt-c-text-dark-1); 49 | --color-text: var(--vt-c-text-dark-2); 50 | } 51 | } 52 | 53 | *, 54 | *::before, 55 | *::after { 56 | box-sizing: border-box; 57 | margin: 0; 58 | position: relative; 59 | font-weight: normal; 60 | } 61 | 62 | body { 63 | min-height: 100vh; 64 | color: var(--color-text); 65 | background: var(--color-background); 66 | transition: color 0.5s, background-color 0.5s; 67 | line-height: 1.6; 68 | font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 69 | Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; 70 | font-size: 15px; 71 | text-rendering: optimizeLegibility; 72 | -webkit-font-smoothing: antialiased; 73 | -moz-osx-font-smoothing: grayscale; 74 | } 75 | -------------------------------------------------------------------------------- /src/assets/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/assets/main.css: -------------------------------------------------------------------------------- 1 | @import './base.css'; 2 | 3 | #app { 4 | max-width: 1280px; 5 | margin: 0 auto; 6 | padding: 2rem; 7 | 8 | font-weight: normal; 9 | } 10 | 11 | a, 12 | .green { 13 | text-decoration: none; 14 | color: hsla(160, 100%, 37%, 1); 15 | transition: 0.4s; 16 | } 17 | 18 | @media (hover: hover) { 19 | a:hover { 20 | background-color: hsla(160, 100%, 37%, 0.2); 21 | } 22 | } 23 | 24 | @media (min-width: 1024px) { 25 | body { 26 | display: flex; 27 | place-items: center; 28 | } 29 | 30 | #app { 31 | display: grid; 32 | grid-template-columns: 1fr 1fr; 33 | padding: 0 2rem; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/assets/sun_full_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eleven-Trading/TradeNote/56eb096631f95c1cdf5d9ef416e7d0115c56465e/src/assets/sun_full_blue.png -------------------------------------------------------------------------------- /src/components/NoData.vue: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/components/ReturnToTopButton.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | -------------------------------------------------------------------------------- /src/components/SideMenu.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | -------------------------------------------------------------------------------- /src/components/SpinnerLoadingPage.vue: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /src/components/icons/IconCommunity.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /src/components/icons/IconDocumentation.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /src/components/icons/IconEcosystem.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /src/components/icons/IconSupport.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /src/components/icons/IconTooling.vue: -------------------------------------------------------------------------------- 1 | 2 | 20 | -------------------------------------------------------------------------------- /src/layouts/Dashboard.vue: -------------------------------------------------------------------------------- 1 | 23 | -------------------------------------------------------------------------------- /src/layouts/LoginRegister.vue: -------------------------------------------------------------------------------- 1 | 36 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import { createApp } from 'vue' 2 | import { createPinia } from 'pinia' 3 | 4 | import App from './App.vue' 5 | import router from './router' 6 | 7 | import './assets/style-dark.css' 8 | 9 | 10 | const app = createApp(App) 11 | 12 | 13 | app.use(createPinia()) 14 | app.use(router) 15 | 16 | app.mount('#app') -------------------------------------------------------------------------------- /src/stores/counter.js: -------------------------------------------------------------------------------- 1 | import { ref } from 'vue' 2 | import { defineStore } from 'pinia' 3 | 4 | /*export const useCounterStore = defineStore('counter', () => { 5 | const count = ref(0) 6 | const doubleCount = computed(() => count.value * 2) 7 | function increment() { 8 | count.value++ 9 | } 10 | 11 | return { count, doubleCount, increment } 12 | })*/ 13 | 14 | export const useTest = defineStore('testing', () => { 15 | state: () => { 16 | 17 | } 18 | const testNumber = ref() 19 | 20 | function changeTestNumber(param) { 21 | console.log("Store param "+param) 22 | testNumber.value = param 23 | } 24 | return { testNumber, changeTestNumber } 25 | }) 26 | 27 | export const useCounterStore = defineStore('counter', { 28 | state: () => ({ count: 0, name: 'Eduardo' }), 29 | getters: { 30 | doubleCount: (state) => state.count * 2, 31 | }, 32 | actions: { 33 | increment() { 34 | this.count++ 35 | }, 36 | }, 37 | }) 38 | -------------------------------------------------------------------------------- /src/utils/filters.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eleven-Trading/TradeNote/56eb096631f95c1cdf5d9ef416e7d0115c56465e/src/utils/filters.js -------------------------------------------------------------------------------- /src/views/Calendar.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | -------------------------------------------------------------------------------- /src/views/Checkout.vue: -------------------------------------------------------------------------------- 1 | 66 | -------------------------------------------------------------------------------- /src/views/Login.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 8 | -------------------------------------------------------------------------------- /src/views/Playbook.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | -------------------------------------------------------------------------------- /src/views/Register.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 26 | -------------------------------------------------------------------------------- /src/views/Screenshots.vue: -------------------------------------------------------------------------------- 1 | 38 | 39 | -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { fileURLToPath, URL } from 'node:url' 2 | 3 | import { defineConfig } from 'vite' 4 | import vue from '@vitejs/plugin-vue' 5 | 6 | // https://vitejs.dev/config/ 7 | export default defineConfig({ 8 | plugins: [vue()], 9 | resolve: { 10 | alias: { 11 | '@': fileURLToPath(new URL('./src', import.meta.url)) 12 | } 13 | } 14 | }) 15 | --------------------------------------------------------------------------------