@crowdedkingdoms/crowdy-dsh 0.2.0-dev.2 → 0.2.1-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dsh-web/BUILD.json +9 -9
- package/dist/dsh-web/crowdy.html +1 -1
- package/dist/dsh-web/index.html +1 -1
- package/dist/dsh-web/preview/crowdy-boot-Cklh1qNl.js +5 -0
- package/dist/dsh-web/preview/vfs-image.tar.gz +0 -0
- package/lib/vendor/crowdyjs-sdk.js +457 -49
- package/lib/vendor/crowdyjs-sdk.version.json +2 -2
- package/package.json +42 -42
- package/dist/dsh-web/preview/crowdy-boot-D0e56jZN.js +0 -2
package/dist/dsh-web/BUILD.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package": "@crowdedkingdoms/crowdy-dsh",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"builtAt": "2026-09-
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"builtAt": "2026-09-12T19:12:14.957Z",
|
|
5
5
|
"source": {
|
|
6
6
|
"repository": "CrowdedKingdoms/crowdy-dsh",
|
|
7
|
-
"commit": "
|
|
7
|
+
"commit": "5e6aca875ea7f4f40a88833cfe9449534c67a9da",
|
|
8
8
|
"dirty": false
|
|
9
9
|
},
|
|
10
10
|
"upstream": {
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"crowdyjs": {
|
|
17
17
|
"name": "@crowdedkingdoms/crowdyjs",
|
|
18
|
-
"version": "16.0.0",
|
|
19
|
-
"source": "
|
|
18
|
+
"version": "16.0.0-dev.1",
|
|
19
|
+
"source": "node_modules"
|
|
20
20
|
},
|
|
21
21
|
"files": {
|
|
22
22
|
"assets/client-Dbm2RGSD.js": "sha256:61fac496cef7bb89d3ac9d248943a7789c7ddfedc76c242aa635620b8ae80047",
|
|
@@ -106,13 +106,13 @@
|
|
|
106
106
|
"assets/langs/yaml-Buea-lGh.js": "sha256:8aad9cddbe3602b06b194e66d021aa63d715df01cf94e8ffcac810e48f0529e3",
|
|
107
107
|
"assets/vendor-BNsW4eBh.css": "sha256:9860041e810431da5a6b83e63f883ab8ff4fc49b4af3fc76681b46f778783a9f",
|
|
108
108
|
"assets/vendor-CCJJTK99.js": "sha256:38f95ea3ff85b49dc4d8f237db208bbaedd2cb8c31611215c246dde41786ff21",
|
|
109
|
-
"crowdy.html": "sha256:
|
|
109
|
+
"crowdy.html": "sha256:84c71419024da7eccec58730ffac32f10c7f3104eca17bdf979dbf3d810039b1",
|
|
110
110
|
"favicon.svg": "sha256:c61a62a9d47d8660f9cfe08aac6775ff0476f7d6c5053f7659c1f8493fd6d814",
|
|
111
|
-
"index.html": "sha256:
|
|
111
|
+
"index.html": "sha256:84c71419024da7eccec58730ffac32f10c7f3104eca17bdf979dbf3d810039b1",
|
|
112
112
|
"manifest.webmanifest": "sha256:9b54d57eea00f2fdd1affe6e7999a4209a515755f12ac1a3299da2d55e178d4c",
|
|
113
113
|
"preview/bootstrap-CYECZNXt.js": "sha256:9f303a0485c0badfdd19fad0c357ef050c5b9a343744ab5bf0c70015e7d95092",
|
|
114
|
-
"preview/crowdy-boot-
|
|
115
|
-
"preview/vfs-image.tar.gz": "sha256:
|
|
114
|
+
"preview/crowdy-boot-Cklh1qNl.js": "sha256:b21e8eb126e1cd8a52159d2d577e610df6c8af36a436f9ed5028cfabd11a85ff",
|
|
115
|
+
"preview/vfs-image.tar.gz": "sha256:f115578ebcd30d7260c73f1ada514055565a5222cfb24ef1c8232cb74d24a076",
|
|
116
116
|
"preview/worker-C8-_ANaz.js": "sha256:81099e5732dfe0c32bacd5897316b7956c5a0a22da01b4a0c6e21d0a3b9d9aa1"
|
|
117
117
|
}
|
|
118
118
|
}
|
package/dist/dsh-web/crowdy.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<link rel="manifest" href="./manifest.webmanifest" />
|
|
7
7
|
<link rel="icon" type="image/svg+xml" href="./favicon.svg" />
|
|
8
8
|
<title>Crowdy Studio Agent</title>
|
|
9
|
-
<script type="module" crossorigin src="./preview/crowdy-boot-
|
|
9
|
+
<script type="module" crossorigin src="./preview/crowdy-boot-Cklh1qNl.js"></script><script type="module" crossorigin src="./assets/index-BKQ_L1z6.js"></script>
|
|
10
10
|
<link rel="modulepreload" crossorigin href="./assets/vendor-CCJJTK99.js">
|
|
11
11
|
<link rel="stylesheet" crossorigin href="./assets/vendor-BNsW4eBh.css">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="./assets/index-DPX2bQLO.css">
|
package/dist/dsh-web/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<link rel="manifest" href="./manifest.webmanifest" />
|
|
7
7
|
<link rel="icon" type="image/svg+xml" href="./favicon.svg" />
|
|
8
8
|
<title>Crowdy Studio Agent</title>
|
|
9
|
-
<script type="module" crossorigin src="./preview/crowdy-boot-
|
|
9
|
+
<script type="module" crossorigin src="./preview/crowdy-boot-Cklh1qNl.js"></script><script type="module" crossorigin src="./assets/index-BKQ_L1z6.js"></script>
|
|
10
10
|
<link rel="modulepreload" crossorigin href="./assets/vendor-CCJJTK99.js">
|
|
11
11
|
<link rel="stylesheet" crossorigin href="./assets/vendor-BNsW4eBh.css">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="./assets/index-DPX2bQLO.css">
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{W as m,c as $,I as v}from"../assets/client-Dbm2RGSD.js";var b={namespace:"ui-onboarding",field:"welcomeNoticeVersion",version:"2026-08-13.1"};globalThis.__DSH_BOOT_READY__??=Promise.withResolvers();const u="/dsh/workspace",O="crowdy-dsh",k=`preview/${v}`,E=new URLSearchParams(location.search),S=E.get("standalone")==="1",g=window.parent!==window,d=new TextEncoder;function p(t){g&&window.parent.postMessage({...t,source:"crowdy-dsh"},location.origin)}function _(){return new Promise(t=>{const e=setInterval(()=>p({type:"crowdy-dsh:ready"}),250),n=r=>{if(r.origin!==location.origin)return;const s=r.data;!s||s.type!=="crowdy-dsh:boot"||(clearInterval(e),window.removeEventListener("message",n),t(s))};window.addEventListener("message",n),p({type:"crowdy-dsh:ready"})})}function h(t,e,n,r){t.set(d.encode(r.toString(8).padStart(n-1,"0")),e)}function T(t){const e=[];for(const[o,a]of t){let i=o,w="";if(d.encode(o).length>100){const l=o.lastIndexOf("/",o.length-100);if(l<=0)throw new Error(`overlay: entry name too long: ${o}`);w=o.slice(0,l),i=o.slice(l+1)}const c=new Uint8Array(512);c.set(d.encode(i),0),h(c,100,8,420),h(c,108,8,0),h(c,116,8,0),h(c,124,12,a.length),h(c,136,12,0),c.fill(32,148,156),c[156]=48,c.set(d.encode("ustar"),257),c.set(d.encode("00"),263),c.set(d.encode(w),345);let f=0;for(const l of c)f+=l;c.set(d.encode(f.toString(8).padStart(6,"0")),148),c[154]=0,c[155]=32,e.push(c,a);const y=a.length%512;y!==0&&e.push(new Uint8Array(512-y))}e.push(new Uint8Array(1024));const n=e.reduce((o,a)=>o+a.length,0),r=new Uint8Array(n);let s=0;for(const o of e)r.set(o,s),s+=o.length;return r}async function A(t){const e=new Blob([t]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(e).arrayBuffer())}async function U(t,e){const n=navigator.storage;if(!n||typeof n.getDirectory!="function")return 0;let r;try{r=await n.getDirectory();for(const a of[O,...t.split("/").filter(Boolean)])r=await r.getDirectoryHandle(a)}catch{return 0}let s=0;const o=async(a,i)=>{const w=a.entries();for await(const[c,f]of w){const y=`${i}${c}`;if(f.kind==="directory")await o(f,`${y}/`);else{const l=await f.getFile();e.set(`home/${y}`,new Uint8Array(await l.arrayBuffer())),s+=1}}};return await o(r,""),s}async function M(t){const e=new Map;let n=0;if(t.persistScope)try{n=await U(t.persistScope,e)}catch(s){console.warn("crowdy-dsh: session restore failed; starting fresh",s),e.clear()}for(const[s,o]of Object.entries(t.files??{})){const a=s.replace(/^\/+/,"");if(!a||a.includes(".."))continue;const i=a==="settings.yaml"||a==="home/settings.yaml"?R(o):o;e.set(a.startsWith("home/")?a:`home/${a}`,d.encode(i))}if(e.size===0)return;console.info(`crowdy-dsh: overlay carries ${e.size} file(s) (${n} restored)`);const r=await A(T(e));return URL.createObjectURL(new Blob([r],{type:"application/gzip"}))}function R(t){const{namespace:e,field:n,version:r}=b;if(new RegExp(`^${e}:`,"m").test(t))return t;const s=`${e}:
|
|
2
|
+
${n}: ${JSON.stringify(r)}
|
|
3
|
+
`;return`${t.replace(/\n*$/,`
|
|
4
|
+
`)}${s}`}async function I(t,e,n){const r=`crowdy-${Math.random().toString(36).slice(2)}`,s=await t(`/api/${e}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({type:"client-request",rpcId:r,method:e,payload:{args:n}})});if(!s.ok)throw new Error(`${e}: HTTP ${s.status}`);const o=await s.json();if(!o.result.ok)throw new Error(`${e}: ${o.result.error.code} ${o.result.error.message}`);return o.result.value}async function N(){const t=S||!g?{type:"crowdy-dsh:boot",mount:u}:await _(),e=t.mount??u,n=[],r=await M(t);r&&n.push(r),n.push(...t.overlays??[]);const s=new m({name:"dsh-host"}),o=await $(s,{image:k,overlays:n}),a=(i,w)=>o.tunnel.fetch(i,w);try{await I(a,"workspace/create",{request:{path:e}})}catch(i){console.warn("crowdy-dsh: workspace registration failed",i)}p({type:"crowdy-dsh:booted",mount:e})}N().catch(t=>{console.error("crowdy-dsh: boot failed",t),p({type:"crowdy-dsh:failed",message:t instanceof Error?t.message:String(t)})});
|
|
5
|
+
//# sourceMappingURL=crowdy-boot-Cklh1qNl.js.map
|
|
Binary file
|
|
@@ -212,9 +212,7 @@ var GraphQLError = class _GraphQLError extends Error {
|
|
|
212
212
|
*
|
|
213
213
|
* Enumerable, and appears in the result of JSON.stringify().
|
|
214
214
|
*/
|
|
215
|
-
/**
|
|
216
|
-
* An array of GraphQL AST Nodes corresponding to this error.
|
|
217
|
-
*/
|
|
215
|
+
/** An array of GraphQL AST Nodes corresponding to this error. */
|
|
218
216
|
/**
|
|
219
217
|
* The source GraphQL document for the first location of this error.
|
|
220
218
|
*
|
|
@@ -225,13 +223,89 @@ var GraphQLError = class _GraphQLError extends Error {
|
|
|
225
223
|
* An array of character offsets within the source GraphQL document
|
|
226
224
|
* which correspond to this error.
|
|
227
225
|
*/
|
|
226
|
+
/** Original error that caused this GraphQLError, if one exists. */
|
|
227
|
+
/** Extension fields to add to the formatted error. */
|
|
228
228
|
/**
|
|
229
|
-
*
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
*
|
|
229
|
+
* Creates a GraphQLError instance.
|
|
230
|
+
* @param message - Human-readable error message.
|
|
231
|
+
* @param options - Error metadata such as source locations, response path, original error, and extensions.
|
|
232
|
+
* This positional-arguments constructor overload is deprecated. Use the
|
|
233
|
+
* `GraphQLError(message, options)` overload instead.
|
|
234
|
+
* @example
|
|
235
|
+
* ```ts
|
|
236
|
+
* // Create an error from AST nodes and response metadata.
|
|
237
|
+
* import { parse } from 'graphql/language';
|
|
238
|
+
* import { GraphQLError } from 'graphql/error';
|
|
239
|
+
*
|
|
240
|
+
* const document = parse('{ greeting }');
|
|
241
|
+
* const fieldNode = document.definitions[0].selectionSet.selections[0];
|
|
242
|
+
* const error = new GraphQLError('Cannot query this field.', {
|
|
243
|
+
* nodes: fieldNode,
|
|
244
|
+
* path: ['greeting'],
|
|
245
|
+
* extensions: { code: 'FORBIDDEN' },
|
|
246
|
+
* });
|
|
247
|
+
*
|
|
248
|
+
* error.message; // => 'Cannot query this field.'
|
|
249
|
+
* error.locations; // => [{ line: 1, column: 3 }]
|
|
250
|
+
* error.path; // => ['greeting']
|
|
251
|
+
* error.extensions; // => { code: 'FORBIDDEN' }
|
|
252
|
+
* ```
|
|
253
|
+
* @example
|
|
254
|
+
* ```ts
|
|
255
|
+
* // This variant derives locations from source positions and preserves the original error.
|
|
256
|
+
* import { Source } from 'graphql/language';
|
|
257
|
+
* import { GraphQLError } from 'graphql/error';
|
|
258
|
+
*
|
|
259
|
+
* const source = new Source('{ greeting }');
|
|
260
|
+
* const originalError = new Error('Database unavailable.');
|
|
261
|
+
* const error = new GraphQLError('Resolver failed.', {
|
|
262
|
+
* source,
|
|
263
|
+
* positions: [2],
|
|
264
|
+
* path: ['greeting'],
|
|
265
|
+
* originalError,
|
|
266
|
+
* });
|
|
267
|
+
*
|
|
268
|
+
* error.locations; // => [{ line: 1, column: 3 }]
|
|
269
|
+
* error.path; // => ['greeting']
|
|
270
|
+
* error.originalError; // => originalError
|
|
271
|
+
* ```
|
|
233
272
|
*/
|
|
234
273
|
/**
|
|
274
|
+
* Creates a GraphQLError instance using the legacy positional constructor.
|
|
275
|
+
* This deprecated overload will be removed in v17. Prefer the
|
|
276
|
+
* `GraphQLErrorOptions` object overload, which keeps optional error metadata
|
|
277
|
+
* in a single options bag.
|
|
278
|
+
* @param message - Human-readable error message.
|
|
279
|
+
* @param nodes - AST node or nodes associated with this error.
|
|
280
|
+
* @param source - Source document used to derive error locations.
|
|
281
|
+
* @param positions - Character offsets in the source document associated with
|
|
282
|
+
* this error.
|
|
283
|
+
* @param path - Response path where this error occurred during execution.
|
|
284
|
+
* @param originalError - Original error that caused this GraphQLError, if one
|
|
285
|
+
* exists.
|
|
286
|
+
* @param extensions - Extension fields to include in the formatted error.
|
|
287
|
+
* @example
|
|
288
|
+
* ```ts
|
|
289
|
+
* import { Source } from 'graphql/language';
|
|
290
|
+
* import { GraphQLError } from 'graphql/error';
|
|
291
|
+
*
|
|
292
|
+
* const source = new Source('{ greeting }');
|
|
293
|
+
* const originalError = new Error('Database unavailable.');
|
|
294
|
+
* const error = new GraphQLError(
|
|
295
|
+
* 'Resolver failed.',
|
|
296
|
+
* undefined,
|
|
297
|
+
* source,
|
|
298
|
+
* [2],
|
|
299
|
+
* ['greeting'],
|
|
300
|
+
* originalError,
|
|
301
|
+
* { code: 'INTERNAL' },
|
|
302
|
+
* );
|
|
303
|
+
*
|
|
304
|
+
* error.locations; // => [{ line: 1, column: 3 }]
|
|
305
|
+
* error.path; // => ['greeting']
|
|
306
|
+
* error.originalError; // => originalError
|
|
307
|
+
* error.extensions; // => { code: 'INTERNAL' }
|
|
308
|
+
* ```
|
|
235
309
|
* @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
|
|
236
310
|
*/
|
|
237
311
|
constructor(message, ...rawArgs) {
|
|
@@ -291,9 +365,29 @@ var GraphQLError = class _GraphQLError extends Error {
|
|
|
291
365
|
});
|
|
292
366
|
}
|
|
293
367
|
}
|
|
368
|
+
/**
|
|
369
|
+
* Returns the value used by `Object.prototype.toString`.
|
|
370
|
+
* @returns The built-in string tag for this object.
|
|
371
|
+
*/
|
|
294
372
|
get [Symbol.toStringTag]() {
|
|
295
373
|
return "GraphQLError";
|
|
296
374
|
}
|
|
375
|
+
/**
|
|
376
|
+
* Returns this error as a human-readable message with source locations.
|
|
377
|
+
* @returns The formatted error string.
|
|
378
|
+
* @example
|
|
379
|
+
* ```ts
|
|
380
|
+
* import { Source } from 'graphql/language';
|
|
381
|
+
* import { GraphQLError } from 'graphql/error';
|
|
382
|
+
*
|
|
383
|
+
* const error = new GraphQLError('Cannot query field "name".', {
|
|
384
|
+
* source: new Source('{ name }'),
|
|
385
|
+
* positions: [2],
|
|
386
|
+
* });
|
|
387
|
+
*
|
|
388
|
+
* error.toString(); // => 'Cannot query field "name".\n\nGraphQL request:1:3\n1 | { name }\n | ^'
|
|
389
|
+
* ```
|
|
390
|
+
*/
|
|
297
391
|
toString() {
|
|
298
392
|
let output = this.message;
|
|
299
393
|
if (this.nodes) {
|
|
@@ -309,6 +403,21 @@ var GraphQLError = class _GraphQLError extends Error {
|
|
|
309
403
|
}
|
|
310
404
|
return output;
|
|
311
405
|
}
|
|
406
|
+
/**
|
|
407
|
+
* Returns the JSON representation used when this object is serialized.
|
|
408
|
+
* @returns The JSON-serializable representation.
|
|
409
|
+
* @example
|
|
410
|
+
* ```ts
|
|
411
|
+
* import { GraphQLError } from 'graphql/error';
|
|
412
|
+
*
|
|
413
|
+
* const error = new GraphQLError('Resolver failed.', {
|
|
414
|
+
* path: ['viewer', 'name'],
|
|
415
|
+
* extensions: { code: 'INTERNAL' },
|
|
416
|
+
* });
|
|
417
|
+
*
|
|
418
|
+
* error.toJSON(); // => { message: 'Resolver failed.', path: ['viewer', 'name'], extensions: { code: 'INTERNAL' } }
|
|
419
|
+
* ```
|
|
420
|
+
*/
|
|
312
421
|
toJSON() {
|
|
313
422
|
const formattedError = {
|
|
314
423
|
message: this.message
|
|
@@ -337,20 +446,29 @@ function syntaxError(source, position, description) {
|
|
|
337
446
|
}
|
|
338
447
|
|
|
339
448
|
var Location = class {
|
|
340
|
-
/**
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
*
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
*
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
*
|
|
449
|
+
/** The character offset at which this Node begins. */
|
|
450
|
+
/** The character offset at which this Node ends. */
|
|
451
|
+
/** The Token at which this Node begins. */
|
|
452
|
+
/** The Token at which this Node ends. */
|
|
453
|
+
/** The Source document the AST represents. */
|
|
454
|
+
/**
|
|
455
|
+
* Creates a Location instance.
|
|
456
|
+
* @param startToken - The start token.
|
|
457
|
+
* @param endToken - The end token.
|
|
458
|
+
* @param source - Source document used to derive error locations.
|
|
459
|
+
* @example
|
|
460
|
+
* ```ts
|
|
461
|
+
* import { Location, Source, Token, TokenKind } from 'graphql/language';
|
|
462
|
+
*
|
|
463
|
+
* const source = new Source('{ hello }');
|
|
464
|
+
* const startToken = new Token(TokenKind.BRACE_L, 0, 1, 1, 1);
|
|
465
|
+
* const endToken = new Token(TokenKind.BRACE_R, 8, 9, 1, 9);
|
|
466
|
+
* const location = new Location(startToken, endToken, source);
|
|
467
|
+
*
|
|
468
|
+
* location.start; // => 0
|
|
469
|
+
* location.end; // => 9
|
|
470
|
+
* location.source.body; // => '{ hello }'
|
|
471
|
+
* ```
|
|
354
472
|
*/
|
|
355
473
|
constructor(startToken, endToken, source) {
|
|
356
474
|
this.start = startToken.start;
|
|
@@ -359,9 +477,26 @@ var Location = class {
|
|
|
359
477
|
this.endToken = endToken;
|
|
360
478
|
this.source = source;
|
|
361
479
|
}
|
|
480
|
+
/**
|
|
481
|
+
* Returns the value used by `Object.prototype.toString`.
|
|
482
|
+
* @returns The built-in string tag for this object.
|
|
483
|
+
*/
|
|
362
484
|
get [Symbol.toStringTag]() {
|
|
363
485
|
return "Location";
|
|
364
486
|
}
|
|
487
|
+
/**
|
|
488
|
+
* Returns a JSON representation of this location.
|
|
489
|
+
* @returns The JSON-serializable representation.
|
|
490
|
+
* @example
|
|
491
|
+
* ```ts
|
|
492
|
+
* import { parse } from 'graphql/language';
|
|
493
|
+
*
|
|
494
|
+
* const document = parse('{ hello }');
|
|
495
|
+
* const location = document.loc?.toJSON();
|
|
496
|
+
*
|
|
497
|
+
* location; // => { start: 0, end: 9 }
|
|
498
|
+
* ```
|
|
499
|
+
*/
|
|
365
500
|
toJSON() {
|
|
366
501
|
return {
|
|
367
502
|
start: this.start,
|
|
@@ -370,21 +505,11 @@ var Location = class {
|
|
|
370
505
|
}
|
|
371
506
|
};
|
|
372
507
|
var Token = class {
|
|
373
|
-
/**
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
|
|
378
|
-
*/
|
|
379
|
-
/**
|
|
380
|
-
* The character offset at which this Node ends.
|
|
381
|
-
*/
|
|
382
|
-
/**
|
|
383
|
-
* The 1-indexed line number on which this Token appears.
|
|
384
|
-
*/
|
|
385
|
-
/**
|
|
386
|
-
* The 1-indexed column number at which this Token begins.
|
|
387
|
-
*/
|
|
508
|
+
/** The kind of Token. */
|
|
509
|
+
/** The character offset at which this Node begins. */
|
|
510
|
+
/** The character offset at which this Node ends. */
|
|
511
|
+
/** The 1-indexed line number on which this Token appears. */
|
|
512
|
+
/** The 1-indexed column number at which this Token begins. */
|
|
388
513
|
/**
|
|
389
514
|
* For non-punctuation tokens, represents the interpreted value of the token.
|
|
390
515
|
*
|
|
@@ -396,6 +521,26 @@ var Token = class {
|
|
|
396
521
|
* including ignored tokens. <SOF> is always the first node and <EOF>
|
|
397
522
|
* the last.
|
|
398
523
|
*/
|
|
524
|
+
/** Next token in the token stream, including ignored tokens. */
|
|
525
|
+
/**
|
|
526
|
+
* Creates a Token instance.
|
|
527
|
+
* @param kind - Token kind produced by lexical analysis.
|
|
528
|
+
* @param start - Character offset where this token begins.
|
|
529
|
+
* @param end - Character offset where this token ends.
|
|
530
|
+
* @param line - One-indexed line number where this token begins.
|
|
531
|
+
* @param column - One-indexed column number where this token begins.
|
|
532
|
+
* @param value - Interpreted value for non-punctuation tokens.
|
|
533
|
+
* @example
|
|
534
|
+
* ```ts
|
|
535
|
+
* import { Token, TokenKind } from 'graphql/language';
|
|
536
|
+
*
|
|
537
|
+
* const token = new Token(TokenKind.NAME, 2, 7, 1, 3, 'hello');
|
|
538
|
+
*
|
|
539
|
+
* token.kind; // => TokenKind.NAME
|
|
540
|
+
* token.value; // => 'hello'
|
|
541
|
+
* token.toJSON(); // => { kind: 'Name', value: 'hello', line: 1, column: 3 }
|
|
542
|
+
* ```
|
|
543
|
+
*/
|
|
399
544
|
constructor(kind, start, end, line, column, value) {
|
|
400
545
|
this.kind = kind;
|
|
401
546
|
this.start = start;
|
|
@@ -406,9 +551,26 @@ var Token = class {
|
|
|
406
551
|
this.prev = null;
|
|
407
552
|
this.next = null;
|
|
408
553
|
}
|
|
554
|
+
/**
|
|
555
|
+
* Returns the value used by `Object.prototype.toString`.
|
|
556
|
+
* @returns The built-in string tag for this object.
|
|
557
|
+
*/
|
|
409
558
|
get [Symbol.toStringTag]() {
|
|
410
559
|
return "Token";
|
|
411
560
|
}
|
|
561
|
+
/**
|
|
562
|
+
* Returns a JSON representation of this token.
|
|
563
|
+
* @returns The JSON-serializable representation.
|
|
564
|
+
* @example
|
|
565
|
+
* ```ts
|
|
566
|
+
* import { Lexer, Source } from 'graphql/language';
|
|
567
|
+
*
|
|
568
|
+
* const lexer = new Lexer(new Source('{ hello }'));
|
|
569
|
+
* const token = lexer.advance().toJSON();
|
|
570
|
+
*
|
|
571
|
+
* token; // => { kind: '{', value: undefined, line: 1, column: 1 }
|
|
572
|
+
* ```
|
|
573
|
+
*/
|
|
412
574
|
toJSON() {
|
|
413
575
|
return {
|
|
414
576
|
kind: this.kind,
|
|
@@ -492,8 +654,15 @@ var QueryDocumentKeys = {
|
|
|
492
654
|
EnumTypeDefinition: ["description", "name", "directives", "values"],
|
|
493
655
|
EnumValueDefinition: ["description", "name", "directives"],
|
|
494
656
|
InputObjectTypeDefinition: ["description", "name", "directives", "fields"],
|
|
495
|
-
DirectiveDefinition: [
|
|
657
|
+
DirectiveDefinition: [
|
|
658
|
+
"description",
|
|
659
|
+
"name",
|
|
660
|
+
"arguments",
|
|
661
|
+
"directives",
|
|
662
|
+
"locations"
|
|
663
|
+
],
|
|
496
664
|
SchemaExtension: ["directives", "operationTypes"],
|
|
665
|
+
DirectiveExtension: ["name", "directives"],
|
|
497
666
|
ScalarTypeExtension: ["name", "directives"],
|
|
498
667
|
ObjectTypeExtension: ["name", "interfaces", "directives", "fields"],
|
|
499
668
|
InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"],
|
|
@@ -539,6 +708,7 @@ var DirectiveLocation;
|
|
|
539
708
|
DirectiveLocation2["ENUM_VALUE"] = "ENUM_VALUE";
|
|
540
709
|
DirectiveLocation2["INPUT_OBJECT"] = "INPUT_OBJECT";
|
|
541
710
|
DirectiveLocation2["INPUT_FIELD_DEFINITION"] = "INPUT_FIELD_DEFINITION";
|
|
711
|
+
DirectiveLocation2["DIRECTIVE_DEFINITION"] = "DIRECTIVE_DEFINITION";
|
|
542
712
|
})(DirectiveLocation || (DirectiveLocation = {}));
|
|
543
713
|
|
|
544
714
|
var Kind;
|
|
@@ -580,6 +750,7 @@ var Kind;
|
|
|
580
750
|
Kind2["INPUT_OBJECT_TYPE_DEFINITION"] = "InputObjectTypeDefinition";
|
|
581
751
|
Kind2["DIRECTIVE_DEFINITION"] = "DirectiveDefinition";
|
|
582
752
|
Kind2["SCHEMA_EXTENSION"] = "SchemaExtension";
|
|
753
|
+
Kind2["DIRECTIVE_EXTENSION"] = "DirectiveExtension";
|
|
583
754
|
Kind2["SCALAR_TYPE_EXTENSION"] = "ScalarTypeExtension";
|
|
584
755
|
Kind2["OBJECT_TYPE_EXTENSION"] = "ObjectTypeExtension";
|
|
585
756
|
Kind2["INTERFACE_TYPE_EXTENSION"] = "InterfaceTypeExtension";
|
|
@@ -691,17 +862,25 @@ var TokenKind;
|
|
|
691
862
|
})(TokenKind || (TokenKind = {}));
|
|
692
863
|
|
|
693
864
|
var Lexer = class {
|
|
694
|
-
/**
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
/**
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
*
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
*
|
|
865
|
+
/** Source document used to derive error locations. */
|
|
866
|
+
/** Most recent non-ignored token returned by the lexer. */
|
|
867
|
+
/** Current non-ignored token at the lexer cursor. */
|
|
868
|
+
/** The (1-indexed) line containing the current token. */
|
|
869
|
+
/** Character offset where the current line starts. */
|
|
870
|
+
/**
|
|
871
|
+
* Creates a Lexer instance.
|
|
872
|
+
* @param source - Source document used to derive error locations.
|
|
873
|
+
* @example
|
|
874
|
+
* ```ts
|
|
875
|
+
* import { Lexer, Source, TokenKind } from 'graphql/language';
|
|
876
|
+
*
|
|
877
|
+
* const lexer = new Lexer(new Source('{ hello }'));
|
|
878
|
+
*
|
|
879
|
+
* lexer.token.kind; // => TokenKind.SOF
|
|
880
|
+
* lexer.advance().kind; // => TokenKind.BRACE_L
|
|
881
|
+
* lexer.advance().value; // => 'hello'
|
|
882
|
+
* lexer.advance().kind; // => TokenKind.BRACE_R
|
|
883
|
+
* ```
|
|
705
884
|
*/
|
|
706
885
|
constructor(source) {
|
|
707
886
|
const startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0);
|
|
@@ -711,11 +890,26 @@ var Lexer = class {
|
|
|
711
890
|
this.line = 1;
|
|
712
891
|
this.lineStart = 0;
|
|
713
892
|
}
|
|
893
|
+
/**
|
|
894
|
+
* Returns the value used by `Object.prototype.toString`.
|
|
895
|
+
* @returns The built-in string tag for this object.
|
|
896
|
+
*/
|
|
714
897
|
get [Symbol.toStringTag]() {
|
|
715
898
|
return "Lexer";
|
|
716
899
|
}
|
|
717
900
|
/**
|
|
718
901
|
* Advances the token stream to the next non-ignored token.
|
|
902
|
+
* @returns The next non-ignored token.
|
|
903
|
+
* @example
|
|
904
|
+
* ```ts
|
|
905
|
+
* import { Lexer, Source } from 'graphql/language';
|
|
906
|
+
*
|
|
907
|
+
* const lexer = new Lexer(new Source('{ hello }'));
|
|
908
|
+
* const token = lexer.advance();
|
|
909
|
+
*
|
|
910
|
+
* token.kind; // => '{'
|
|
911
|
+
* lexer.token; // => token
|
|
912
|
+
* ```
|
|
719
913
|
*/
|
|
720
914
|
advance() {
|
|
721
915
|
this.lastToken = this.token;
|
|
@@ -725,6 +919,17 @@ var Lexer = class {
|
|
|
725
919
|
/**
|
|
726
920
|
* Looks ahead and returns the next non-ignored token, but does not change
|
|
727
921
|
* the state of Lexer.
|
|
922
|
+
* @returns The next non-ignored token without advancing the lexer.
|
|
923
|
+
* @example
|
|
924
|
+
* ```ts
|
|
925
|
+
* import { Lexer, Source } from 'graphql/language';
|
|
926
|
+
*
|
|
927
|
+
* const lexer = new Lexer(new Source('{ hello }'));
|
|
928
|
+
* const token = lexer.lookahead();
|
|
929
|
+
*
|
|
930
|
+
* token.kind; // => '{'
|
|
931
|
+
* lexer.token.kind; // => '<SOF>'
|
|
932
|
+
* ```
|
|
728
933
|
*/
|
|
729
934
|
lookahead() {
|
|
730
935
|
let token = this.token;
|
|
@@ -1342,6 +1547,29 @@ spurious results.`);
|
|
|
1342
1547
|
);
|
|
1343
1548
|
|
|
1344
1549
|
var Source = class {
|
|
1550
|
+
/** The GraphQL source text. */
|
|
1551
|
+
/** Name used in diagnostics for this source, such as a file path or request name. */
|
|
1552
|
+
/** One-indexed line and column where this source begins. */
|
|
1553
|
+
/**
|
|
1554
|
+
* Creates a Source instance.
|
|
1555
|
+
* @param body - The GraphQL source text.
|
|
1556
|
+
* @param name - Name used in diagnostics for this source.
|
|
1557
|
+
* @param locationOffset - One-indexed line and column where this source begins.
|
|
1558
|
+
* @example
|
|
1559
|
+
* ```ts
|
|
1560
|
+
* import { Source } from 'graphql/language';
|
|
1561
|
+
*
|
|
1562
|
+
* const source = new Source(
|
|
1563
|
+
* 'type Query { greeting: String }',
|
|
1564
|
+
* 'schema.graphql',
|
|
1565
|
+
* { line: 10, column: 1 },
|
|
1566
|
+
* );
|
|
1567
|
+
*
|
|
1568
|
+
* source.body; // => 'type Query { greeting: String }'
|
|
1569
|
+
* source.name; // => 'schema.graphql'
|
|
1570
|
+
* source.locationOffset; // => { line: 10, column: 1 }
|
|
1571
|
+
* ```
|
|
1572
|
+
*/
|
|
1345
1573
|
constructor(body, name = "GraphQL request", locationOffset = {
|
|
1346
1574
|
line: 1,
|
|
1347
1575
|
column: 1
|
|
@@ -1359,6 +1587,10 @@ var Source = class {
|
|
|
1359
1587
|
"column in locationOffset is 1-indexed and must be positive."
|
|
1360
1588
|
);
|
|
1361
1589
|
}
|
|
1590
|
+
/**
|
|
1591
|
+
* Returns the value used by `Object.prototype.toString`.
|
|
1592
|
+
* @returns The built-in string tag for this object.
|
|
1593
|
+
*/
|
|
1362
1594
|
get [Symbol.toStringTag]() {
|
|
1363
1595
|
return "Source";
|
|
1364
1596
|
}
|
|
@@ -1393,6 +1625,8 @@ var Parser = class {
|
|
|
1393
1625
|
}
|
|
1394
1626
|
/**
|
|
1395
1627
|
* Converts a name lex token into a name parse node.
|
|
1628
|
+
*
|
|
1629
|
+
* @internal
|
|
1396
1630
|
*/
|
|
1397
1631
|
parseName() {
|
|
1398
1632
|
const token = this.expectToken(TokenKind.NAME);
|
|
@@ -1404,6 +1638,8 @@ var Parser = class {
|
|
|
1404
1638
|
// Implements the parsing rules in the Document section.
|
|
1405
1639
|
/**
|
|
1406
1640
|
* Document : Definition+
|
|
1641
|
+
*
|
|
1642
|
+
* @internal
|
|
1407
1643
|
*/
|
|
1408
1644
|
parseDocument() {
|
|
1409
1645
|
return this.node(this._lexer.token, {
|
|
@@ -1437,6 +1673,8 @@ var Parser = class {
|
|
|
1437
1673
|
* - UnionTypeDefinition
|
|
1438
1674
|
* - EnumTypeDefinition
|
|
1439
1675
|
* - InputObjectTypeDefinition
|
|
1676
|
+
*
|
|
1677
|
+
* @internal
|
|
1440
1678
|
*/
|
|
1441
1679
|
parseDefinition() {
|
|
1442
1680
|
if (this.peek(TokenKind.BRACE_L)) {
|
|
@@ -1497,6 +1735,8 @@ var Parser = class {
|
|
|
1497
1735
|
* OperationDefinition :
|
|
1498
1736
|
* - SelectionSet
|
|
1499
1737
|
* - OperationType Name? VariableDefinitions? Directives? SelectionSet
|
|
1738
|
+
*
|
|
1739
|
+
* @internal
|
|
1500
1740
|
*/
|
|
1501
1741
|
parseOperationDefinition() {
|
|
1502
1742
|
const start = this._lexer.token;
|
|
@@ -1529,6 +1769,8 @@ var Parser = class {
|
|
|
1529
1769
|
}
|
|
1530
1770
|
/**
|
|
1531
1771
|
* OperationType : one of query mutation subscription
|
|
1772
|
+
*
|
|
1773
|
+
* @internal
|
|
1532
1774
|
*/
|
|
1533
1775
|
parseOperationType() {
|
|
1534
1776
|
const operationToken = this.expectToken(TokenKind.NAME);
|
|
@@ -1544,6 +1786,8 @@ var Parser = class {
|
|
|
1544
1786
|
}
|
|
1545
1787
|
/**
|
|
1546
1788
|
* VariableDefinitions : ( VariableDefinition+ )
|
|
1789
|
+
*
|
|
1790
|
+
* @internal
|
|
1547
1791
|
*/
|
|
1548
1792
|
parseVariableDefinitions() {
|
|
1549
1793
|
return this.optionalMany(
|
|
@@ -1554,6 +1798,8 @@ var Parser = class {
|
|
|
1554
1798
|
}
|
|
1555
1799
|
/**
|
|
1556
1800
|
* VariableDefinition : Variable : Type DefaultValue? Directives[Const]?
|
|
1801
|
+
*
|
|
1802
|
+
* @internal
|
|
1557
1803
|
*/
|
|
1558
1804
|
parseVariableDefinition() {
|
|
1559
1805
|
return this.node(this._lexer.token, {
|
|
@@ -1567,6 +1813,8 @@ var Parser = class {
|
|
|
1567
1813
|
}
|
|
1568
1814
|
/**
|
|
1569
1815
|
* Variable : $ Name
|
|
1816
|
+
*
|
|
1817
|
+
* @internal
|
|
1570
1818
|
*/
|
|
1571
1819
|
parseVariable() {
|
|
1572
1820
|
const start = this._lexer.token;
|
|
@@ -1580,6 +1828,8 @@ var Parser = class {
|
|
|
1580
1828
|
* ```
|
|
1581
1829
|
* SelectionSet : { Selection+ }
|
|
1582
1830
|
* ```
|
|
1831
|
+
*
|
|
1832
|
+
* @internal
|
|
1583
1833
|
*/
|
|
1584
1834
|
parseSelectionSet() {
|
|
1585
1835
|
return this.node(this._lexer.token, {
|
|
@@ -1596,6 +1846,8 @@ var Parser = class {
|
|
|
1596
1846
|
* - Field
|
|
1597
1847
|
* - FragmentSpread
|
|
1598
1848
|
* - InlineFragment
|
|
1849
|
+
*
|
|
1850
|
+
* @internal
|
|
1599
1851
|
*/
|
|
1600
1852
|
parseSelection() {
|
|
1601
1853
|
return this.peek(TokenKind.SPREAD) ? this.parseFragment() : this.parseField();
|
|
@@ -1604,6 +1856,8 @@ var Parser = class {
|
|
|
1604
1856
|
* Field : Alias? Name Arguments? Directives? SelectionSet?
|
|
1605
1857
|
*
|
|
1606
1858
|
* Alias : Name :
|
|
1859
|
+
*
|
|
1860
|
+
* @internal
|
|
1607
1861
|
*/
|
|
1608
1862
|
parseField() {
|
|
1609
1863
|
const start = this._lexer.token;
|
|
@@ -1627,6 +1881,8 @@ var Parser = class {
|
|
|
1627
1881
|
}
|
|
1628
1882
|
/**
|
|
1629
1883
|
* Arguments[Const] : ( Argument[?Const]+ )
|
|
1884
|
+
*
|
|
1885
|
+
* @internal
|
|
1630
1886
|
*/
|
|
1631
1887
|
parseArguments(isConst) {
|
|
1632
1888
|
const item = isConst ? this.parseConstArgument : this.parseArgument;
|
|
@@ -1634,6 +1890,8 @@ var Parser = class {
|
|
|
1634
1890
|
}
|
|
1635
1891
|
/**
|
|
1636
1892
|
* Argument[Const] : Name : Value[?Const]
|
|
1893
|
+
*
|
|
1894
|
+
* @internal
|
|
1637
1895
|
*/
|
|
1638
1896
|
parseArgument(isConst = false) {
|
|
1639
1897
|
const start = this._lexer.token;
|
|
@@ -1655,6 +1913,8 @@ var Parser = class {
|
|
|
1655
1913
|
* FragmentSpread : ... FragmentName Directives?
|
|
1656
1914
|
*
|
|
1657
1915
|
* InlineFragment : ... TypeCondition? Directives? SelectionSet
|
|
1916
|
+
*
|
|
1917
|
+
* @internal
|
|
1658
1918
|
*/
|
|
1659
1919
|
parseFragment() {
|
|
1660
1920
|
const start = this._lexer.token;
|
|
@@ -1679,6 +1939,8 @@ var Parser = class {
|
|
|
1679
1939
|
* - fragment FragmentName on TypeCondition Directives? SelectionSet
|
|
1680
1940
|
*
|
|
1681
1941
|
* TypeCondition : NamedType
|
|
1942
|
+
*
|
|
1943
|
+
* @internal
|
|
1682
1944
|
*/
|
|
1683
1945
|
parseFragmentDefinition() {
|
|
1684
1946
|
const start = this._lexer.token;
|
|
@@ -1706,6 +1968,8 @@ var Parser = class {
|
|
|
1706
1968
|
}
|
|
1707
1969
|
/**
|
|
1708
1970
|
* FragmentName : Name but not `on`
|
|
1971
|
+
*
|
|
1972
|
+
* @internal
|
|
1709
1973
|
*/
|
|
1710
1974
|
parseFragmentName() {
|
|
1711
1975
|
if (this._lexer.token.value === "on") {
|
|
@@ -1731,6 +1995,8 @@ var Parser = class {
|
|
|
1731
1995
|
* NullValue : `null`
|
|
1732
1996
|
*
|
|
1733
1997
|
* EnumValue : Name but not `true`, `false` or `null`
|
|
1998
|
+
*
|
|
1999
|
+
* @internal
|
|
1734
2000
|
*/
|
|
1735
2001
|
parseValueLiteral(isConst) {
|
|
1736
2002
|
const token = this._lexer.token;
|
|
@@ -1812,6 +2078,8 @@ var Parser = class {
|
|
|
1812
2078
|
* ListValue[Const] :
|
|
1813
2079
|
* - [ ]
|
|
1814
2080
|
* - [ Value[?Const]+ ]
|
|
2081
|
+
*
|
|
2082
|
+
* @internal
|
|
1815
2083
|
*/
|
|
1816
2084
|
parseList(isConst) {
|
|
1817
2085
|
const item = () => this.parseValueLiteral(isConst);
|
|
@@ -1826,6 +2094,8 @@ var Parser = class {
|
|
|
1826
2094
|
* - { }
|
|
1827
2095
|
* - { ObjectField[?Const]+ }
|
|
1828
2096
|
* ```
|
|
2097
|
+
*
|
|
2098
|
+
* @internal
|
|
1829
2099
|
*/
|
|
1830
2100
|
parseObject(isConst) {
|
|
1831
2101
|
const item = () => this.parseObjectField(isConst);
|
|
@@ -1836,6 +2106,8 @@ var Parser = class {
|
|
|
1836
2106
|
}
|
|
1837
2107
|
/**
|
|
1838
2108
|
* ObjectField[Const] : Name : Value[?Const]
|
|
2109
|
+
*
|
|
2110
|
+
* @internal
|
|
1839
2111
|
*/
|
|
1840
2112
|
parseObjectField(isConst) {
|
|
1841
2113
|
const start = this._lexer.token;
|
|
@@ -1850,6 +2122,8 @@ var Parser = class {
|
|
|
1850
2122
|
// Implements the parsing rules in the Directives section.
|
|
1851
2123
|
/**
|
|
1852
2124
|
* Directives[Const] : Directive[?Const]+
|
|
2125
|
+
*
|
|
2126
|
+
* @internal
|
|
1853
2127
|
*/
|
|
1854
2128
|
parseDirectives(isConst) {
|
|
1855
2129
|
const directives = [];
|
|
@@ -1865,6 +2139,8 @@ var Parser = class {
|
|
|
1865
2139
|
* ```
|
|
1866
2140
|
* Directive[Const] : @ Name Arguments[?Const]?
|
|
1867
2141
|
* ```
|
|
2142
|
+
*
|
|
2143
|
+
* @internal
|
|
1868
2144
|
*/
|
|
1869
2145
|
parseDirective(isConst) {
|
|
1870
2146
|
const start = this._lexer.token;
|
|
@@ -1881,6 +2157,8 @@ var Parser = class {
|
|
|
1881
2157
|
* - NamedType
|
|
1882
2158
|
* - ListType
|
|
1883
2159
|
* - NonNullType
|
|
2160
|
+
*
|
|
2161
|
+
* @internal
|
|
1884
2162
|
*/
|
|
1885
2163
|
parseTypeReference() {
|
|
1886
2164
|
const start = this._lexer.token;
|
|
@@ -1905,6 +2183,8 @@ var Parser = class {
|
|
|
1905
2183
|
}
|
|
1906
2184
|
/**
|
|
1907
2185
|
* NamedType : Name
|
|
2186
|
+
*
|
|
2187
|
+
* @internal
|
|
1908
2188
|
*/
|
|
1909
2189
|
parseNamedType() {
|
|
1910
2190
|
return this.node(this._lexer.token, {
|
|
@@ -1918,6 +2198,8 @@ var Parser = class {
|
|
|
1918
2198
|
}
|
|
1919
2199
|
/**
|
|
1920
2200
|
* Description : StringValue
|
|
2201
|
+
*
|
|
2202
|
+
* @internal
|
|
1921
2203
|
*/
|
|
1922
2204
|
parseDescription() {
|
|
1923
2205
|
if (this.peekDescription()) {
|
|
@@ -1928,6 +2210,8 @@ var Parser = class {
|
|
|
1928
2210
|
* ```
|
|
1929
2211
|
* SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ }
|
|
1930
2212
|
* ```
|
|
2213
|
+
*
|
|
2214
|
+
* @internal
|
|
1931
2215
|
*/
|
|
1932
2216
|
parseSchemaDefinition() {
|
|
1933
2217
|
const start = this._lexer.token;
|
|
@@ -1948,6 +2232,8 @@ var Parser = class {
|
|
|
1948
2232
|
}
|
|
1949
2233
|
/**
|
|
1950
2234
|
* OperationTypeDefinition : OperationType : NamedType
|
|
2235
|
+
*
|
|
2236
|
+
* @internal
|
|
1951
2237
|
*/
|
|
1952
2238
|
parseOperationTypeDefinition() {
|
|
1953
2239
|
const start = this._lexer.token;
|
|
@@ -1962,6 +2248,8 @@ var Parser = class {
|
|
|
1962
2248
|
}
|
|
1963
2249
|
/**
|
|
1964
2250
|
* ScalarTypeDefinition : Description? scalar Name Directives[Const]?
|
|
2251
|
+
*
|
|
2252
|
+
* @internal
|
|
1965
2253
|
*/
|
|
1966
2254
|
parseScalarTypeDefinition() {
|
|
1967
2255
|
const start = this._lexer.token;
|
|
@@ -1980,6 +2268,8 @@ var Parser = class {
|
|
|
1980
2268
|
* ObjectTypeDefinition :
|
|
1981
2269
|
* Description?
|
|
1982
2270
|
* type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?
|
|
2271
|
+
*
|
|
2272
|
+
* @internal
|
|
1983
2273
|
*/
|
|
1984
2274
|
parseObjectTypeDefinition() {
|
|
1985
2275
|
const start = this._lexer.token;
|
|
@@ -2002,6 +2292,8 @@ var Parser = class {
|
|
|
2002
2292
|
* ImplementsInterfaces :
|
|
2003
2293
|
* - implements `&`? NamedType
|
|
2004
2294
|
* - ImplementsInterfaces & NamedType
|
|
2295
|
+
*
|
|
2296
|
+
* @internal
|
|
2005
2297
|
*/
|
|
2006
2298
|
parseImplementsInterfaces() {
|
|
2007
2299
|
return this.expectOptionalKeyword("implements") ? this.delimitedMany(TokenKind.AMP, this.parseNamedType) : [];
|
|
@@ -2010,6 +2302,8 @@ var Parser = class {
|
|
|
2010
2302
|
* ```
|
|
2011
2303
|
* FieldsDefinition : { FieldDefinition+ }
|
|
2012
2304
|
* ```
|
|
2305
|
+
*
|
|
2306
|
+
* @internal
|
|
2013
2307
|
*/
|
|
2014
2308
|
parseFieldsDefinition() {
|
|
2015
2309
|
return this.optionalMany(
|
|
@@ -2021,6 +2315,8 @@ var Parser = class {
|
|
|
2021
2315
|
/**
|
|
2022
2316
|
* FieldDefinition :
|
|
2023
2317
|
* - Description? Name ArgumentsDefinition? : Type Directives[Const]?
|
|
2318
|
+
*
|
|
2319
|
+
* @internal
|
|
2024
2320
|
*/
|
|
2025
2321
|
parseFieldDefinition() {
|
|
2026
2322
|
const start = this._lexer.token;
|
|
@@ -2041,6 +2337,8 @@ var Parser = class {
|
|
|
2041
2337
|
}
|
|
2042
2338
|
/**
|
|
2043
2339
|
* ArgumentsDefinition : ( InputValueDefinition+ )
|
|
2340
|
+
*
|
|
2341
|
+
* @internal
|
|
2044
2342
|
*/
|
|
2045
2343
|
parseArgumentDefs() {
|
|
2046
2344
|
return this.optionalMany(
|
|
@@ -2052,6 +2350,8 @@ var Parser = class {
|
|
|
2052
2350
|
/**
|
|
2053
2351
|
* InputValueDefinition :
|
|
2054
2352
|
* - Description? Name : Type DefaultValue? Directives[Const]?
|
|
2353
|
+
*
|
|
2354
|
+
* @internal
|
|
2055
2355
|
*/
|
|
2056
2356
|
parseInputValueDef() {
|
|
2057
2357
|
const start = this._lexer.token;
|
|
@@ -2076,6 +2376,8 @@ var Parser = class {
|
|
|
2076
2376
|
/**
|
|
2077
2377
|
* InterfaceTypeDefinition :
|
|
2078
2378
|
* - Description? interface Name Directives[Const]? FieldsDefinition?
|
|
2379
|
+
*
|
|
2380
|
+
* @internal
|
|
2079
2381
|
*/
|
|
2080
2382
|
parseInterfaceTypeDefinition() {
|
|
2081
2383
|
const start = this._lexer.token;
|
|
@@ -2097,6 +2399,8 @@ var Parser = class {
|
|
|
2097
2399
|
/**
|
|
2098
2400
|
* UnionTypeDefinition :
|
|
2099
2401
|
* - Description? union Name Directives[Const]? UnionMemberTypes?
|
|
2402
|
+
*
|
|
2403
|
+
* @internal
|
|
2100
2404
|
*/
|
|
2101
2405
|
parseUnionTypeDefinition() {
|
|
2102
2406
|
const start = this._lexer.token;
|
|
@@ -2117,6 +2421,8 @@ var Parser = class {
|
|
|
2117
2421
|
* UnionMemberTypes :
|
|
2118
2422
|
* - = `|`? NamedType
|
|
2119
2423
|
* - UnionMemberTypes | NamedType
|
|
2424
|
+
*
|
|
2425
|
+
* @internal
|
|
2120
2426
|
*/
|
|
2121
2427
|
parseUnionMemberTypes() {
|
|
2122
2428
|
return this.expectOptionalToken(TokenKind.EQUALS) ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType) : [];
|
|
@@ -2124,6 +2430,8 @@ var Parser = class {
|
|
|
2124
2430
|
/**
|
|
2125
2431
|
* EnumTypeDefinition :
|
|
2126
2432
|
* - Description? enum Name Directives[Const]? EnumValuesDefinition?
|
|
2433
|
+
*
|
|
2434
|
+
* @internal
|
|
2127
2435
|
*/
|
|
2128
2436
|
parseEnumTypeDefinition() {
|
|
2129
2437
|
const start = this._lexer.token;
|
|
@@ -2144,6 +2452,8 @@ var Parser = class {
|
|
|
2144
2452
|
* ```
|
|
2145
2453
|
* EnumValuesDefinition : { EnumValueDefinition+ }
|
|
2146
2454
|
* ```
|
|
2455
|
+
*
|
|
2456
|
+
* @internal
|
|
2147
2457
|
*/
|
|
2148
2458
|
parseEnumValuesDefinition() {
|
|
2149
2459
|
return this.optionalMany(
|
|
@@ -2154,6 +2464,8 @@ var Parser = class {
|
|
|
2154
2464
|
}
|
|
2155
2465
|
/**
|
|
2156
2466
|
* EnumValueDefinition : Description? EnumValue Directives[Const]?
|
|
2467
|
+
*
|
|
2468
|
+
* @internal
|
|
2157
2469
|
*/
|
|
2158
2470
|
parseEnumValueDefinition() {
|
|
2159
2471
|
const start = this._lexer.token;
|
|
@@ -2169,6 +2481,8 @@ var Parser = class {
|
|
|
2169
2481
|
}
|
|
2170
2482
|
/**
|
|
2171
2483
|
* EnumValue : Name but not `true`, `false` or `null`
|
|
2484
|
+
*
|
|
2485
|
+
* @internal
|
|
2172
2486
|
*/
|
|
2173
2487
|
parseEnumValueName() {
|
|
2174
2488
|
if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null") {
|
|
@@ -2185,6 +2499,8 @@ var Parser = class {
|
|
|
2185
2499
|
/**
|
|
2186
2500
|
* InputObjectTypeDefinition :
|
|
2187
2501
|
* - Description? input Name Directives[Const]? InputFieldsDefinition?
|
|
2502
|
+
*
|
|
2503
|
+
* @internal
|
|
2188
2504
|
*/
|
|
2189
2505
|
parseInputObjectTypeDefinition() {
|
|
2190
2506
|
const start = this._lexer.token;
|
|
@@ -2205,6 +2521,8 @@ var Parser = class {
|
|
|
2205
2521
|
* ```
|
|
2206
2522
|
* InputFieldsDefinition : { InputValueDefinition+ }
|
|
2207
2523
|
* ```
|
|
2524
|
+
*
|
|
2525
|
+
* @internal
|
|
2208
2526
|
*/
|
|
2209
2527
|
parseInputFieldsDefinition() {
|
|
2210
2528
|
return this.optionalMany(
|
|
@@ -2225,6 +2543,9 @@ var Parser = class {
|
|
|
2225
2543
|
* - UnionTypeExtension
|
|
2226
2544
|
* - EnumTypeExtension
|
|
2227
2545
|
* - InputObjectTypeDefinition
|
|
2546
|
+
* - DirectiveDefinitionExtension
|
|
2547
|
+
*
|
|
2548
|
+
* @internal
|
|
2228
2549
|
*/
|
|
2229
2550
|
parseTypeSystemExtension() {
|
|
2230
2551
|
const keywordToken = this._lexer.lookahead();
|
|
@@ -2244,6 +2565,11 @@ var Parser = class {
|
|
|
2244
2565
|
return this.parseEnumTypeExtension();
|
|
2245
2566
|
case "input":
|
|
2246
2567
|
return this.parseInputObjectTypeExtension();
|
|
2568
|
+
case "directive":
|
|
2569
|
+
if (this._options.experimentalDirectivesOnDirectiveDefinitions) {
|
|
2570
|
+
return this.parseDirectiveDefinitionExtension();
|
|
2571
|
+
}
|
|
2572
|
+
break;
|
|
2247
2573
|
}
|
|
2248
2574
|
}
|
|
2249
2575
|
throw this.unexpected(keywordToken);
|
|
@@ -2254,6 +2580,8 @@ var Parser = class {
|
|
|
2254
2580
|
* - extend schema Directives[Const]? { OperationTypeDefinition+ }
|
|
2255
2581
|
* - extend schema Directives[Const]
|
|
2256
2582
|
* ```
|
|
2583
|
+
*
|
|
2584
|
+
* @internal
|
|
2257
2585
|
*/
|
|
2258
2586
|
parseSchemaExtension() {
|
|
2259
2587
|
const start = this._lexer.token;
|
|
@@ -2277,6 +2605,8 @@ var Parser = class {
|
|
|
2277
2605
|
/**
|
|
2278
2606
|
* ScalarTypeExtension :
|
|
2279
2607
|
* - extend scalar Name Directives[Const]
|
|
2608
|
+
*
|
|
2609
|
+
* @internal
|
|
2280
2610
|
*/
|
|
2281
2611
|
parseScalarTypeExtension() {
|
|
2282
2612
|
const start = this._lexer.token;
|
|
@@ -2298,6 +2628,8 @@ var Parser = class {
|
|
|
2298
2628
|
* - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
|
|
2299
2629
|
* - extend type Name ImplementsInterfaces? Directives[Const]
|
|
2300
2630
|
* - extend type Name ImplementsInterfaces
|
|
2631
|
+
*
|
|
2632
|
+
* @internal
|
|
2301
2633
|
*/
|
|
2302
2634
|
parseObjectTypeExtension() {
|
|
2303
2635
|
const start = this._lexer.token;
|
|
@@ -2323,6 +2655,8 @@ var Parser = class {
|
|
|
2323
2655
|
* - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
|
|
2324
2656
|
* - extend interface Name ImplementsInterfaces? Directives[Const]
|
|
2325
2657
|
* - extend interface Name ImplementsInterfaces
|
|
2658
|
+
*
|
|
2659
|
+
* @internal
|
|
2326
2660
|
*/
|
|
2327
2661
|
parseInterfaceTypeExtension() {
|
|
2328
2662
|
const start = this._lexer.token;
|
|
@@ -2347,6 +2681,8 @@ var Parser = class {
|
|
|
2347
2681
|
* UnionTypeExtension :
|
|
2348
2682
|
* - extend union Name Directives[Const]? UnionMemberTypes
|
|
2349
2683
|
* - extend union Name Directives[Const]
|
|
2684
|
+
*
|
|
2685
|
+
* @internal
|
|
2350
2686
|
*/
|
|
2351
2687
|
parseUnionTypeExtension() {
|
|
2352
2688
|
const start = this._lexer.token;
|
|
@@ -2369,6 +2705,8 @@ var Parser = class {
|
|
|
2369
2705
|
* EnumTypeExtension :
|
|
2370
2706
|
* - extend enum Name Directives[Const]? EnumValuesDefinition
|
|
2371
2707
|
* - extend enum Name Directives[Const]
|
|
2708
|
+
*
|
|
2709
|
+
* @internal
|
|
2372
2710
|
*/
|
|
2373
2711
|
parseEnumTypeExtension() {
|
|
2374
2712
|
const start = this._lexer.token;
|
|
@@ -2391,6 +2729,8 @@ var Parser = class {
|
|
|
2391
2729
|
* InputObjectTypeExtension :
|
|
2392
2730
|
* - extend input Name Directives[Const]? InputFieldsDefinition
|
|
2393
2731
|
* - extend input Name Directives[Const]
|
|
2732
|
+
*
|
|
2733
|
+
* @internal
|
|
2394
2734
|
*/
|
|
2395
2735
|
parseInputObjectTypeExtension() {
|
|
2396
2736
|
const start = this._lexer.token;
|
|
@@ -2409,11 +2749,29 @@ var Parser = class {
|
|
|
2409
2749
|
fields
|
|
2410
2750
|
});
|
|
2411
2751
|
}
|
|
2752
|
+
parseDirectiveDefinitionExtension() {
|
|
2753
|
+
const start = this._lexer.token;
|
|
2754
|
+
this.expectKeyword("extend");
|
|
2755
|
+
this.expectKeyword("directive");
|
|
2756
|
+
this.expectToken(TokenKind.AT);
|
|
2757
|
+
const name = this.parseName();
|
|
2758
|
+
const directives = this.parseConstDirectives();
|
|
2759
|
+
if (directives.length === 0) {
|
|
2760
|
+
throw this.unexpected();
|
|
2761
|
+
}
|
|
2762
|
+
return this.node(start, {
|
|
2763
|
+
kind: Kind.DIRECTIVE_EXTENSION,
|
|
2764
|
+
name,
|
|
2765
|
+
directives
|
|
2766
|
+
});
|
|
2767
|
+
}
|
|
2412
2768
|
/**
|
|
2413
2769
|
* ```
|
|
2414
2770
|
* DirectiveDefinition :
|
|
2415
2771
|
* - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations
|
|
2416
2772
|
* ```
|
|
2773
|
+
*
|
|
2774
|
+
* @internal
|
|
2417
2775
|
*/
|
|
2418
2776
|
parseDirectiveDefinition() {
|
|
2419
2777
|
const start = this._lexer.token;
|
|
@@ -2422,6 +2780,7 @@ var Parser = class {
|
|
|
2422
2780
|
this.expectToken(TokenKind.AT);
|
|
2423
2781
|
const name = this.parseName();
|
|
2424
2782
|
const args = this.parseArgumentDefs();
|
|
2783
|
+
const directives = this._options.experimentalDirectivesOnDirectiveDefinitions ? this.parseConstDirectives() : [];
|
|
2425
2784
|
const repeatable = this.expectOptionalKeyword("repeatable");
|
|
2426
2785
|
this.expectKeyword("on");
|
|
2427
2786
|
const locations = this.parseDirectiveLocations();
|
|
@@ -2430,6 +2789,7 @@ var Parser = class {
|
|
|
2430
2789
|
description,
|
|
2431
2790
|
name,
|
|
2432
2791
|
arguments: args,
|
|
2792
|
+
directives,
|
|
2433
2793
|
repeatable,
|
|
2434
2794
|
locations
|
|
2435
2795
|
});
|
|
@@ -2438,6 +2798,8 @@ var Parser = class {
|
|
|
2438
2798
|
* DirectiveLocations :
|
|
2439
2799
|
* - `|`? DirectiveLocation
|
|
2440
2800
|
* - DirectiveLocations | DirectiveLocation
|
|
2801
|
+
*
|
|
2802
|
+
* @internal
|
|
2441
2803
|
*/
|
|
2442
2804
|
parseDirectiveLocations() {
|
|
2443
2805
|
return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation);
|
|
@@ -2468,6 +2830,7 @@ var Parser = class {
|
|
|
2468
2830
|
* `ENUM_VALUE`
|
|
2469
2831
|
* `INPUT_OBJECT`
|
|
2470
2832
|
* `INPUT_FIELD_DEFINITION`
|
|
2833
|
+
* `DIRECTIVE_DEFINITION`
|
|
2471
2834
|
*/
|
|
2472
2835
|
parseDirectiveLocation() {
|
|
2473
2836
|
const start = this._lexer.token;
|
|
@@ -2485,6 +2848,19 @@ var Parser = class {
|
|
|
2485
2848
|
* - Name . Name ( Name : )
|
|
2486
2849
|
* - \@ Name
|
|
2487
2850
|
* - \@ Name ( Name : )
|
|
2851
|
+
* @returns Parsed schema coordinate AST.
|
|
2852
|
+
* @example
|
|
2853
|
+
* ```ts
|
|
2854
|
+
* import { Parser, Source } from 'graphql/language';
|
|
2855
|
+
*
|
|
2856
|
+
* const typeCoordinate = new Parser(new Source('User.name')).parseSchemaCoordinate();
|
|
2857
|
+
* const directiveCoordinate = new Parser(new Source('@include(if:)')).parseSchemaCoordinate();
|
|
2858
|
+
*
|
|
2859
|
+
* typeCoordinate.name.value; // => 'User'
|
|
2860
|
+
* typeCoordinate.memberName?.value; // => 'name'
|
|
2861
|
+
* directiveCoordinate.name.value; // => 'deprecated'
|
|
2862
|
+
* directiveCoordinate.argumentName?.value; // => 'reason'
|
|
2863
|
+
* ```
|
|
2488
2864
|
*/
|
|
2489
2865
|
parseSchemaCoordinate() {
|
|
2490
2866
|
const start = this._lexer.token;
|
|
@@ -2537,6 +2913,8 @@ var Parser = class {
|
|
|
2537
2913
|
* Returns a node that, if configured to do so, sets a "loc" field as a
|
|
2538
2914
|
* location object, used to identify the place in the source that created a
|
|
2539
2915
|
* given parsed object.
|
|
2916
|
+
*
|
|
2917
|
+
* @internal
|
|
2540
2918
|
*/
|
|
2541
2919
|
node(startToken, node) {
|
|
2542
2920
|
if (this._options.noLocation !== true) {
|
|
@@ -2550,6 +2928,8 @@ var Parser = class {
|
|
|
2550
2928
|
}
|
|
2551
2929
|
/**
|
|
2552
2930
|
* Determines if the next token is of a given kind
|
|
2931
|
+
*
|
|
2932
|
+
* @internal
|
|
2553
2933
|
*/
|
|
2554
2934
|
peek(kind) {
|
|
2555
2935
|
return this._lexer.token.kind === kind;
|
|
@@ -2557,6 +2937,8 @@ var Parser = class {
|
|
|
2557
2937
|
/**
|
|
2558
2938
|
* If the next token is of the given kind, return that token after advancing the lexer.
|
|
2559
2939
|
* Otherwise, do not change the parser state and throw an error.
|
|
2940
|
+
*
|
|
2941
|
+
* @internal
|
|
2560
2942
|
*/
|
|
2561
2943
|
expectToken(kind) {
|
|
2562
2944
|
const token = this._lexer.token;
|
|
@@ -2573,6 +2955,8 @@ var Parser = class {
|
|
|
2573
2955
|
/**
|
|
2574
2956
|
* If the next token is of the given kind, return "true" after advancing the lexer.
|
|
2575
2957
|
* Otherwise, do not change the parser state and return "false".
|
|
2958
|
+
*
|
|
2959
|
+
* @internal
|
|
2576
2960
|
*/
|
|
2577
2961
|
expectOptionalToken(kind) {
|
|
2578
2962
|
const token = this._lexer.token;
|
|
@@ -2585,6 +2969,8 @@ var Parser = class {
|
|
|
2585
2969
|
/**
|
|
2586
2970
|
* If the next token is a given keyword, advance the lexer.
|
|
2587
2971
|
* Otherwise, do not change the parser state and throw an error.
|
|
2972
|
+
*
|
|
2973
|
+
* @internal
|
|
2588
2974
|
*/
|
|
2589
2975
|
expectKeyword(value) {
|
|
2590
2976
|
const token = this._lexer.token;
|
|
@@ -2601,6 +2987,8 @@ var Parser = class {
|
|
|
2601
2987
|
/**
|
|
2602
2988
|
* If the next token is a given keyword, return "true" after advancing the lexer.
|
|
2603
2989
|
* Otherwise, do not change the parser state and return "false".
|
|
2990
|
+
*
|
|
2991
|
+
* @internal
|
|
2604
2992
|
*/
|
|
2605
2993
|
expectOptionalKeyword(value) {
|
|
2606
2994
|
const token = this._lexer.token;
|
|
@@ -2612,6 +3000,8 @@ var Parser = class {
|
|
|
2612
3000
|
}
|
|
2613
3001
|
/**
|
|
2614
3002
|
* Helper function for creating an error when an unexpected lexed token is encountered.
|
|
3003
|
+
*
|
|
3004
|
+
* @internal
|
|
2615
3005
|
*/
|
|
2616
3006
|
unexpected(atToken) {
|
|
2617
3007
|
const token = atToken !== null && atToken !== void 0 ? atToken : this._lexer.token;
|
|
@@ -2625,6 +3015,8 @@ var Parser = class {
|
|
|
2625
3015
|
* Returns a possibly empty list of parse nodes, determined by the parseFn.
|
|
2626
3016
|
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2627
3017
|
* Advances the parser to the next lex token after the closing token.
|
|
3018
|
+
*
|
|
3019
|
+
* @internal
|
|
2628
3020
|
*/
|
|
2629
3021
|
any(openKind, parseFn, closeKind) {
|
|
2630
3022
|
this.expectToken(openKind);
|
|
@@ -2639,6 +3031,8 @@ var Parser = class {
|
|
|
2639
3031
|
* It can be empty only if open token is missing otherwise it will always return non-empty list
|
|
2640
3032
|
* that begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2641
3033
|
* Advances the parser to the next lex token after the closing token.
|
|
3034
|
+
*
|
|
3035
|
+
* @internal
|
|
2642
3036
|
*/
|
|
2643
3037
|
optionalMany(openKind, parseFn, closeKind) {
|
|
2644
3038
|
if (this.expectOptionalToken(openKind)) {
|
|
@@ -2654,6 +3048,8 @@ var Parser = class {
|
|
|
2654
3048
|
* Returns a non-empty list of parse nodes, determined by the parseFn.
|
|
2655
3049
|
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2656
3050
|
* Advances the parser to the next lex token after the closing token.
|
|
3051
|
+
*
|
|
3052
|
+
* @internal
|
|
2657
3053
|
*/
|
|
2658
3054
|
many(openKind, parseFn, closeKind) {
|
|
2659
3055
|
this.expectToken(openKind);
|
|
@@ -2667,6 +3063,8 @@ var Parser = class {
|
|
|
2667
3063
|
* Returns a non-empty list of parse nodes, determined by the parseFn.
|
|
2668
3064
|
* This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
|
|
2669
3065
|
* Advances the parser to the next lex token after last item in the list.
|
|
3066
|
+
*
|
|
3067
|
+
* @internal
|
|
2670
3068
|
*/
|
|
2671
3069
|
delimitedMany(delimiterKind, parseFn) {
|
|
2672
3070
|
this.expectOptionalToken(delimiterKind);
|
|
@@ -3178,7 +3576,14 @@ var printDocASTReducer = {
|
|
|
3178
3576
|
leave: ({ description, name, directives, fields }) => wrap("", description, "\n") + join(["input", name, join(directives, " "), block(fields)], " ")
|
|
3179
3577
|
},
|
|
3180
3578
|
DirectiveDefinition: {
|
|
3181
|
-
leave: ({
|
|
3579
|
+
leave: ({
|
|
3580
|
+
description,
|
|
3581
|
+
name,
|
|
3582
|
+
arguments: args,
|
|
3583
|
+
directives,
|
|
3584
|
+
repeatable,
|
|
3585
|
+
locations
|
|
3586
|
+
}) => wrap("", description, "\n") + "directive @" + name + (hasMultilineItems(args) ? wrap("(\n", indent(join(args, "\n")), "\n)") : wrap("(", join(args, ", "), ")")) + wrap(" ", join(directives, " ")) + (repeatable ? " repeatable" : "") + " on " + join(locations, " | ")
|
|
3182
3587
|
},
|
|
3183
3588
|
SchemaExtension: {
|
|
3184
3589
|
leave: ({ directives, operationTypes }) => join(
|
|
@@ -3230,6 +3635,9 @@ var printDocASTReducer = {
|
|
|
3230
3635
|
InputObjectTypeExtension: {
|
|
3231
3636
|
leave: ({ name, directives, fields }) => join(["extend input", name, join(directives, " "), block(fields)], " ")
|
|
3232
3637
|
},
|
|
3638
|
+
DirectiveExtension: {
|
|
3639
|
+
leave: ({ name, directives }) => join(["extend directive @" + name, join(directives, " ")], " ")
|
|
3640
|
+
},
|
|
3233
3641
|
// Schema Coordinates
|
|
3234
3642
|
TypeCoordinate: {
|
|
3235
3643
|
leave: ({ name }) => name
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crowdedkingdoms/crowdy-dsh",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1-dev.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -59,14 +59,46 @@
|
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=22.19"
|
|
61
61
|
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"@deepseek-ai/cordis": "*",
|
|
64
|
+
"@deepseek-ai/dsh-attachment": "*",
|
|
65
|
+
"@deepseek-ai/dsh-fs": "*",
|
|
66
|
+
"@deepseek-ai/dsh-llm": "*",
|
|
67
|
+
"@deepseek-ai/dsh-tools": "*",
|
|
68
|
+
"@deepseek-ai/dsh-user-approval": "*",
|
|
69
|
+
"@deepseek-ai/schemastery": "*"
|
|
70
|
+
},
|
|
71
|
+
"peerDependenciesMeta": {
|
|
72
|
+
"@deepseek-ai/cordis": {
|
|
73
|
+
"optional": true
|
|
74
|
+
},
|
|
75
|
+
"@deepseek-ai/dsh-attachment": {
|
|
76
|
+
"optional": true
|
|
77
|
+
},
|
|
78
|
+
"@deepseek-ai/dsh-fs": {
|
|
79
|
+
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"@deepseek-ai/dsh-llm": {
|
|
82
|
+
"optional": true
|
|
83
|
+
},
|
|
84
|
+
"@deepseek-ai/dsh-tools": {
|
|
85
|
+
"optional": true
|
|
86
|
+
},
|
|
87
|
+
"@deepseek-ai/dsh-user-approval": {
|
|
88
|
+
"optional": true
|
|
89
|
+
},
|
|
90
|
+
"@deepseek-ai/schemastery": {
|
|
91
|
+
"optional": true
|
|
92
|
+
}
|
|
93
|
+
},
|
|
62
94
|
"crowdyDsh": {
|
|
63
95
|
"build": {
|
|
64
96
|
"package": "@crowdedkingdoms/crowdy-dsh",
|
|
65
|
-
"version": "0.2.
|
|
66
|
-
"builtAt": "2026-09-
|
|
97
|
+
"version": "0.2.1",
|
|
98
|
+
"builtAt": "2026-09-12T19:12:14.957Z",
|
|
67
99
|
"source": {
|
|
68
100
|
"repository": "CrowdedKingdoms/crowdy-dsh",
|
|
69
|
-
"commit": "
|
|
101
|
+
"commit": "5e6aca875ea7f4f40a88833cfe9449534c67a9da",
|
|
70
102
|
"dirty": false
|
|
71
103
|
},
|
|
72
104
|
"upstream": {
|
|
@@ -77,8 +109,8 @@
|
|
|
77
109
|
},
|
|
78
110
|
"crowdyjs": {
|
|
79
111
|
"name": "@crowdedkingdoms/crowdyjs",
|
|
80
|
-
"version": "16.0.0",
|
|
81
|
-
"source": "
|
|
112
|
+
"version": "16.0.0-dev.1",
|
|
113
|
+
"source": "node_modules"
|
|
82
114
|
},
|
|
83
115
|
"files": {
|
|
84
116
|
"assets/client-Dbm2RGSD.js": "sha256:61fac496cef7bb89d3ac9d248943a7789c7ddfedc76c242aa635620b8ae80047",
|
|
@@ -168,47 +200,15 @@
|
|
|
168
200
|
"assets/langs/yaml-Buea-lGh.js": "sha256:8aad9cddbe3602b06b194e66d021aa63d715df01cf94e8ffcac810e48f0529e3",
|
|
169
201
|
"assets/vendor-BNsW4eBh.css": "sha256:9860041e810431da5a6b83e63f883ab8ff4fc49b4af3fc76681b46f778783a9f",
|
|
170
202
|
"assets/vendor-CCJJTK99.js": "sha256:38f95ea3ff85b49dc4d8f237db208bbaedd2cb8c31611215c246dde41786ff21",
|
|
171
|
-
"crowdy.html": "sha256:
|
|
203
|
+
"crowdy.html": "sha256:84c71419024da7eccec58730ffac32f10c7f3104eca17bdf979dbf3d810039b1",
|
|
172
204
|
"favicon.svg": "sha256:c61a62a9d47d8660f9cfe08aac6775ff0476f7d6c5053f7659c1f8493fd6d814",
|
|
173
|
-
"index.html": "sha256:
|
|
205
|
+
"index.html": "sha256:84c71419024da7eccec58730ffac32f10c7f3104eca17bdf979dbf3d810039b1",
|
|
174
206
|
"manifest.webmanifest": "sha256:9b54d57eea00f2fdd1affe6e7999a4209a515755f12ac1a3299da2d55e178d4c",
|
|
175
207
|
"preview/bootstrap-CYECZNXt.js": "sha256:9f303a0485c0badfdd19fad0c357ef050c5b9a343744ab5bf0c70015e7d95092",
|
|
176
|
-
"preview/crowdy-boot-
|
|
177
|
-
"preview/vfs-image.tar.gz": "sha256:
|
|
208
|
+
"preview/crowdy-boot-Cklh1qNl.js": "sha256:b21e8eb126e1cd8a52159d2d577e610df6c8af36a436f9ed5028cfabd11a85ff",
|
|
209
|
+
"preview/vfs-image.tar.gz": "sha256:f115578ebcd30d7260c73f1ada514055565a5222cfb24ef1c8232cb74d24a076",
|
|
178
210
|
"preview/worker-C8-_ANaz.js": "sha256:81099e5732dfe0c32bacd5897316b7956c5a0a22da01b4a0c6e21d0a3b9d9aa1"
|
|
179
211
|
}
|
|
180
212
|
}
|
|
181
|
-
},
|
|
182
|
-
"peerDependencies": {
|
|
183
|
-
"@deepseek-ai/cordis": "*",
|
|
184
|
-
"@deepseek-ai/dsh-attachment": "*",
|
|
185
|
-
"@deepseek-ai/dsh-fs": "*",
|
|
186
|
-
"@deepseek-ai/dsh-llm": "*",
|
|
187
|
-
"@deepseek-ai/dsh-tools": "*",
|
|
188
|
-
"@deepseek-ai/dsh-user-approval": "*",
|
|
189
|
-
"@deepseek-ai/schemastery": "*"
|
|
190
|
-
},
|
|
191
|
-
"peerDependenciesMeta": {
|
|
192
|
-
"@deepseek-ai/cordis": {
|
|
193
|
-
"optional": true
|
|
194
|
-
},
|
|
195
|
-
"@deepseek-ai/dsh-attachment": {
|
|
196
|
-
"optional": true
|
|
197
|
-
},
|
|
198
|
-
"@deepseek-ai/dsh-fs": {
|
|
199
|
-
"optional": true
|
|
200
|
-
},
|
|
201
|
-
"@deepseek-ai/dsh-llm": {
|
|
202
|
-
"optional": true
|
|
203
|
-
},
|
|
204
|
-
"@deepseek-ai/dsh-tools": {
|
|
205
|
-
"optional": true
|
|
206
|
-
},
|
|
207
|
-
"@deepseek-ai/dsh-user-approval": {
|
|
208
|
-
"optional": true
|
|
209
|
-
},
|
|
210
|
-
"@deepseek-ai/schemastery": {
|
|
211
|
-
"optional": true
|
|
212
|
-
}
|
|
213
213
|
}
|
|
214
214
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{W as m,c as v,I as $}from"../assets/client-Dbm2RGSD.js";globalThis.__DSH_BOOT_READY__??=Promise.withResolvers();const u="/dsh/workspace",b="crowdy-dsh",k=`preview/${$}`,S=new URLSearchParams(location.search),O=S.get("standalone")==="1",g=window.parent!==window,d=new TextEncoder;function p(t){g&&window.parent.postMessage({...t,source:"crowdy-dsh"},location.origin)}function E(){return new Promise(t=>{const e=setInterval(()=>p({type:"crowdy-dsh:ready"}),250),r=n=>{if(n.origin!==location.origin)return;const s=n.data;!s||s.type!=="crowdy-dsh:boot"||(clearInterval(e),window.removeEventListener("message",r),t(s))};window.addEventListener("message",r),p({type:"crowdy-dsh:ready"})})}function y(t,e,r,n){t.set(d.encode(n.toString(8).padStart(r-1,"0")),e)}function T(t){const e=[];for(const[o,c]of t){let i=o,w="";if(d.encode(o).length>100){const l=o.lastIndexOf("/",o.length-100);if(l<=0)throw new Error(`overlay: entry name too long: ${o}`);w=o.slice(0,l),i=o.slice(l+1)}const a=new Uint8Array(512);a.set(d.encode(i),0),y(a,100,8,420),y(a,108,8,0),y(a,116,8,0),y(a,124,12,c.length),y(a,136,12,0),a.fill(32,148,156),a[156]=48,a.set(d.encode("ustar"),257),a.set(d.encode("00"),263),a.set(d.encode(w),345);let f=0;for(const l of a)f+=l;a.set(d.encode(f.toString(8).padStart(6,"0")),148),a[154]=0,a[155]=32,e.push(a,c);const h=c.length%512;h!==0&&e.push(new Uint8Array(512-h))}e.push(new Uint8Array(1024));const r=e.reduce((o,c)=>o+c.length,0),n=new Uint8Array(r);let s=0;for(const o of e)n.set(o,s),s+=o.length;return n}async function U(t){const e=new Blob([t]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(e).arrayBuffer())}async function A(t,e){const r=navigator.storage;if(!r||typeof r.getDirectory!="function")return 0;let n;try{n=await r.getDirectory();for(const c of[b,...t.split("/").filter(Boolean)])n=await n.getDirectoryHandle(c)}catch{return 0}let s=0;const o=async(c,i)=>{const w=c.entries();for await(const[a,f]of w){const h=`${i}${a}`;if(f.kind==="directory")await o(f,`${h}/`);else{const l=await f.getFile();e.set(`home/${h}`,new Uint8Array(await l.arrayBuffer())),s+=1}}};return await o(n,""),s}async function _(t){const e=new Map;let r=0;if(t.persistScope)try{r=await A(t.persistScope,e)}catch(s){console.warn("crowdy-dsh: session restore failed; starting fresh",s),e.clear()}for(const[s,o]of Object.entries(t.files??{})){const c=s.replace(/^\/+/,"");!c||c.includes("..")||e.set(c.startsWith("home/")?c:`home/${c}`,d.encode(o))}if(e.size===0)return;console.info(`crowdy-dsh: overlay carries ${e.size} file(s) (${r} restored)`);const n=await U(T(e));return URL.createObjectURL(new Blob([n],{type:"application/gzip"}))}async function M(t,e,r){const n=`crowdy-${Math.random().toString(36).slice(2)}`,s=await t(`/api/${e}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({type:"client-request",rpcId:n,method:e,payload:{args:r}})});if(!s.ok)throw new Error(`${e}: HTTP ${s.status}`);const o=await s.json();if(!o.result.ok)throw new Error(`${e}: ${o.result.error.code} ${o.result.error.message}`);return o.result.value}async function B(){const t=O||!g?{type:"crowdy-dsh:boot",mount:u}:await E(),e=t.mount??u,r=[],n=await _(t);n&&r.push(n),r.push(...t.overlays??[]);const s=new m({name:"dsh-host"}),o=await v(s,{image:k,overlays:r}),c=(i,w)=>o.tunnel.fetch(i,w);try{await M(c,"workspace/create",{request:{path:e}})}catch(i){console.warn("crowdy-dsh: workspace registration failed",i)}p({type:"crowdy-dsh:booted",mount:e})}B().catch(t=>{console.error("crowdy-dsh: boot failed",t),p({type:"crowdy-dsh:failed",message:t instanceof Error?t.message:String(t)})});
|
|
2
|
-
//# sourceMappingURL=crowdy-boot-D0e56jZN.js.map
|