houdini 1.2.54 → 1.2.55
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/build/cmd-cjs/index.js +141 -60
- package/build/cmd-esm/index.js +141 -60
- package/build/codegen-cjs/index.js +139 -58
- package/build/codegen-esm/index.js +139 -58
- package/build/lib-cjs/index.js +142 -59
- package/build/lib-esm/index.js +142 -59
- package/build/runtime/cache/cache.d.ts +1 -2
- package/build/runtime/cache/constants.d.ts +1 -0
- package/build/runtime/cache/lists.d.ts +2 -2
- package/build/runtime/cache/storage.d.ts +4 -4
- package/build/runtime/cache/stuff.d.ts +1 -0
- package/build/runtime/cache/subscription.d.ts +4 -1
- package/build/runtime-cjs/cache/cache.d.ts +1 -2
- package/build/runtime-cjs/cache/cache.js +41 -14
- package/build/runtime-cjs/cache/constants.d.ts +1 -0
- package/build/runtime-cjs/cache/constants.js +28 -0
- package/build/runtime-cjs/cache/lists.d.ts +2 -2
- package/build/runtime-cjs/cache/lists.js +14 -4
- package/build/runtime-cjs/cache/storage.d.ts +4 -4
- package/build/runtime-cjs/cache/storage.js +14 -6
- package/build/runtime-cjs/cache/stuff.d.ts +1 -0
- package/build/runtime-cjs/cache/stuff.js +5 -2
- package/build/runtime-cjs/cache/subscription.d.ts +4 -1
- package/build/runtime-cjs/cache/subscription.js +51 -19
- package/build/runtime-cjs/client/plugins/optimisticKeys.js +3 -1
- package/build/runtime-cjs/public/record.js +2 -2
- package/build/runtime-esm/cache/cache.d.ts +1 -2
- package/build/runtime-esm/cache/cache.js +35 -7
- package/build/runtime-esm/cache/constants.d.ts +1 -0
- package/build/runtime-esm/cache/constants.js +4 -0
- package/build/runtime-esm/cache/lists.d.ts +2 -2
- package/build/runtime-esm/cache/lists.js +13 -3
- package/build/runtime-esm/cache/storage.d.ts +4 -4
- package/build/runtime-esm/cache/storage.js +14 -6
- package/build/runtime-esm/cache/stuff.d.ts +1 -0
- package/build/runtime-esm/cache/stuff.js +3 -1
- package/build/runtime-esm/cache/subscription.d.ts +4 -1
- package/build/runtime-esm/cache/subscription.js +51 -19
- package/build/runtime-esm/client/plugins/optimisticKeys.js +3 -1
- package/build/runtime-esm/public/record.js +1 -1
- package/build/test-cjs/index.js +139 -58
- package/build/test-esm/index.js +139 -58
- package/build/vite-cjs/index.js +139 -58
- package/build/vite-esm/index.js +139 -58
- package/package.json +1 -1
- package/build/runtime/cache/schema.d.ts +0 -21
- package/build/runtime-cjs/cache/schema.d.ts +0 -21
- package/build/runtime-cjs/cache/schema.js +0 -66
- package/build/runtime-esm/cache/schema.d.ts +0 -21
- package/build/runtime-esm/cache/schema.js +0 -42
package/build/vite-esm/index.js
CHANGED
|
@@ -66683,6 +66683,35 @@ var GarbageCollector = class {
|
|
|
66683
66683
|
}
|
|
66684
66684
|
};
|
|
66685
66685
|
|
|
66686
|
+
// src/runtime/cache/stuff.ts
|
|
66687
|
+
function evaluateKey(key, variables = null) {
|
|
66688
|
+
let evaluated = "";
|
|
66689
|
+
let varName = "";
|
|
66690
|
+
let inString = false;
|
|
66691
|
+
for (const char of key) {
|
|
66692
|
+
if (varName) {
|
|
66693
|
+
if (varChars.includes(char)) {
|
|
66694
|
+
varName += char;
|
|
66695
|
+
continue;
|
|
66696
|
+
}
|
|
66697
|
+
const value = variables?.[varName.slice(1)];
|
|
66698
|
+
evaluated += typeof value !== "undefined" ? JSON.stringify(value) : "undefined";
|
|
66699
|
+
varName = "";
|
|
66700
|
+
}
|
|
66701
|
+
if (char === "$" && !inString) {
|
|
66702
|
+
varName = "$";
|
|
66703
|
+
continue;
|
|
66704
|
+
}
|
|
66705
|
+
if (char === '"') {
|
|
66706
|
+
inString = !inString;
|
|
66707
|
+
}
|
|
66708
|
+
evaluated += char;
|
|
66709
|
+
}
|
|
66710
|
+
return evaluated;
|
|
66711
|
+
}
|
|
66712
|
+
var varChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789";
|
|
66713
|
+
var rootID = "_ROOT_";
|
|
66714
|
+
|
|
66686
66715
|
// src/runtime/cache/lists.ts
|
|
66687
66716
|
var ListManager = class {
|
|
66688
66717
|
rootID;
|
|
@@ -66749,11 +66778,15 @@ var ListManager = class {
|
|
|
66749
66778
|
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
66750
66779
|
}
|
|
66751
66780
|
removeIDFromAllLists(id, layer) {
|
|
66781
|
+
let removed = false;
|
|
66752
66782
|
for (const fieldMap of this.lists.values()) {
|
|
66753
66783
|
for (const list of fieldMap.values()) {
|
|
66754
|
-
list.removeID(id, void 0, layer)
|
|
66784
|
+
if (list.removeID(id, void 0, layer)) {
|
|
66785
|
+
removed = true;
|
|
66786
|
+
}
|
|
66755
66787
|
}
|
|
66756
66788
|
}
|
|
66789
|
+
return removed;
|
|
66757
66790
|
}
|
|
66758
66791
|
deleteField(parentID, field) {
|
|
66759
66792
|
if (!this.listsByField.get(parentID)?.has(field)) {
|
|
@@ -67056,7 +67089,13 @@ var ListCollection = class {
|
|
|
67056
67089
|
this.lists.forEach((list) => list.addToList(...args));
|
|
67057
67090
|
}
|
|
67058
67091
|
removeID(...args) {
|
|
67059
|
-
|
|
67092
|
+
let removed = false;
|
|
67093
|
+
this.lists.forEach((list) => {
|
|
67094
|
+
if (list.removeID(...args)) {
|
|
67095
|
+
removed = true;
|
|
67096
|
+
}
|
|
67097
|
+
});
|
|
67098
|
+
return removed;
|
|
67060
67099
|
}
|
|
67061
67100
|
remove(...args) {
|
|
67062
67101
|
this.lists.forEach((list) => list.remove(...args));
|
|
@@ -67175,6 +67214,7 @@ var InMemoryStorage = class {
|
|
|
67175
67214
|
}
|
|
67176
67215
|
registerIDMapping(from, to) {
|
|
67177
67216
|
this.idMaps[from] = to;
|
|
67217
|
+
this.idMaps[to] = from;
|
|
67178
67218
|
}
|
|
67179
67219
|
createLayer(optimistic = false) {
|
|
67180
67220
|
const layer = new Layer(this.idCount++);
|
|
@@ -67185,11 +67225,11 @@ var InMemoryStorage = class {
|
|
|
67185
67225
|
insert(id, field, location, target) {
|
|
67186
67226
|
return this.topLayer.insert(id, field, location, target);
|
|
67187
67227
|
}
|
|
67188
|
-
remove(id, field, target,
|
|
67189
|
-
return
|
|
67228
|
+
remove(id, field, target, layer = this.topLayer) {
|
|
67229
|
+
return layer.remove(id, field, target);
|
|
67190
67230
|
}
|
|
67191
|
-
delete(id,
|
|
67192
|
-
return
|
|
67231
|
+
delete(id, layer = this.topLayer) {
|
|
67232
|
+
return layer.delete(id);
|
|
67193
67233
|
}
|
|
67194
67234
|
deleteField(id, field) {
|
|
67195
67235
|
return this.topLayer.deleteField(id, field);
|
|
@@ -67227,6 +67267,9 @@ var InMemoryStorage = class {
|
|
|
67227
67267
|
return;
|
|
67228
67268
|
}
|
|
67229
67269
|
operations.remove.add(v);
|
|
67270
|
+
if (this.idMaps[v]) {
|
|
67271
|
+
operations.remove.add(this.idMaps[v]);
|
|
67272
|
+
}
|
|
67230
67273
|
});
|
|
67231
67274
|
if (typeof layerValue === "undefined" && defaultValue) {
|
|
67232
67275
|
const targetLayer = this.topLayer;
|
|
@@ -67253,7 +67296,11 @@ var InMemoryStorage = class {
|
|
|
67253
67296
|
operations.remove.add(op.id);
|
|
67254
67297
|
}
|
|
67255
67298
|
if (isInsertOperation(op)) {
|
|
67256
|
-
|
|
67299
|
+
if (op.location === OperationLocation.end) {
|
|
67300
|
+
operations.insert[op.location].unshift(op.id);
|
|
67301
|
+
} else {
|
|
67302
|
+
operations.insert[op.location].push(op.id);
|
|
67303
|
+
}
|
|
67257
67304
|
}
|
|
67258
67305
|
if (isDeleteOperation(op)) {
|
|
67259
67306
|
return {
|
|
@@ -67499,7 +67546,7 @@ var Layer = class {
|
|
|
67499
67546
|
}
|
|
67500
67547
|
for (const [id, ops] of Object.entries(layer.operations)) {
|
|
67501
67548
|
const fields = {};
|
|
67502
|
-
for (const opMap of [
|
|
67549
|
+
for (const opMap of [layer.operations[id], this.operations[id]].filter(Boolean)) {
|
|
67503
67550
|
for (const [fieldName, operations] of Object.entries(opMap.fields || {})) {
|
|
67504
67551
|
fields[fieldName] = [...fields[fieldName] || [], ...operations];
|
|
67505
67552
|
}
|
|
@@ -67564,34 +67611,6 @@ var OperationKind = {
|
|
|
67564
67611
|
remove: "remove"
|
|
67565
67612
|
};
|
|
67566
67613
|
|
|
67567
|
-
// src/runtime/cache/stuff.ts
|
|
67568
|
-
function evaluateKey(key, variables = null) {
|
|
67569
|
-
let evaluated = "";
|
|
67570
|
-
let varName = "";
|
|
67571
|
-
let inString = false;
|
|
67572
|
-
for (const char of key) {
|
|
67573
|
-
if (varName) {
|
|
67574
|
-
if (varChars.includes(char)) {
|
|
67575
|
-
varName += char;
|
|
67576
|
-
continue;
|
|
67577
|
-
}
|
|
67578
|
-
const value = variables?.[varName.slice(1)];
|
|
67579
|
-
evaluated += typeof value !== "undefined" ? JSON.stringify(value) : "undefined";
|
|
67580
|
-
varName = "";
|
|
67581
|
-
}
|
|
67582
|
-
if (char === "$" && !inString) {
|
|
67583
|
-
varName = "$";
|
|
67584
|
-
continue;
|
|
67585
|
-
}
|
|
67586
|
-
if (char === '"') {
|
|
67587
|
-
inString = !inString;
|
|
67588
|
-
}
|
|
67589
|
-
evaluated += char;
|
|
67590
|
-
}
|
|
67591
|
-
return evaluated;
|
|
67592
|
-
}
|
|
67593
|
-
var varChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789";
|
|
67594
|
-
|
|
67595
67614
|
// src/runtime/cache/subscription.ts
|
|
67596
67615
|
var InMemorySubscriptions = class {
|
|
67597
67616
|
cache;
|
|
@@ -67603,6 +67622,9 @@ var InMemorySubscriptions = class {
|
|
|
67603
67622
|
activeFields(parent2) {
|
|
67604
67623
|
return Object.keys(this.subscribers.get(parent2) || {});
|
|
67605
67624
|
}
|
|
67625
|
+
copySubscribers(from, to) {
|
|
67626
|
+
this.subscribers.set(to, this.subscribers.get(from) || /* @__PURE__ */ new Map());
|
|
67627
|
+
}
|
|
67606
67628
|
add({
|
|
67607
67629
|
parent: parent2,
|
|
67608
67630
|
spec,
|
|
@@ -67785,6 +67807,11 @@ var InMemorySubscriptions = class {
|
|
|
67785
67807
|
get(id, field) {
|
|
67786
67808
|
return this.subscribers.get(id)?.get(field)?.selections || [];
|
|
67787
67809
|
}
|
|
67810
|
+
getAll(id) {
|
|
67811
|
+
return [...this.subscribers.get(id)?.values() || []].flatMap(
|
|
67812
|
+
(fieldSub) => fieldSub.selections
|
|
67813
|
+
);
|
|
67814
|
+
}
|
|
67788
67815
|
remove(id, selection, targets, variables, visited = []) {
|
|
67789
67816
|
visited.push(id);
|
|
67790
67817
|
const linkedIDs = [];
|
|
@@ -67826,7 +67853,7 @@ var InMemorySubscriptions = class {
|
|
|
67826
67853
|
}
|
|
67827
67854
|
const subscriberField = subscriber.get(fieldName);
|
|
67828
67855
|
for (const spec of specs) {
|
|
67829
|
-
const counts =
|
|
67856
|
+
const counts = subscriberField?.referenceCounts;
|
|
67830
67857
|
if (!counts?.has(spec.set)) {
|
|
67831
67858
|
continue;
|
|
67832
67859
|
}
|
|
@@ -67849,24 +67876,23 @@ var InMemorySubscriptions = class {
|
|
|
67849
67876
|
this.subscribers.delete(id);
|
|
67850
67877
|
}
|
|
67851
67878
|
}
|
|
67852
|
-
removeAllSubscribers(id, targets
|
|
67853
|
-
|
|
67854
|
-
|
|
67855
|
-
|
|
67856
|
-
|
|
67857
|
-
|
|
67858
|
-
|
|
67859
|
-
|
|
67860
|
-
|
|
67861
|
-
|
|
67862
|
-
|
|
67863
|
-
|
|
67864
|
-
|
|
67865
|
-
|
|
67866
|
-
}
|
|
67867
|
-
this.removeAllSubscribers(id2, subscribers, visited);
|
|
67879
|
+
removeAllSubscribers(id, targets) {
|
|
67880
|
+
if (!targets) {
|
|
67881
|
+
targets = [...this.subscribers.get(id)?.values() || []].flatMap(
|
|
67882
|
+
(spec) => spec.selections.flatMap((sel) => sel[0])
|
|
67883
|
+
);
|
|
67884
|
+
}
|
|
67885
|
+
for (const target of targets) {
|
|
67886
|
+
for (const subselection of this.findSubSelections(
|
|
67887
|
+
target.parentID || rootID,
|
|
67888
|
+
target.selection,
|
|
67889
|
+
target.variables || {},
|
|
67890
|
+
id
|
|
67891
|
+
)) {
|
|
67892
|
+
this.remove(id, subselection, targets, target.variables || {});
|
|
67868
67893
|
}
|
|
67869
67894
|
}
|
|
67895
|
+
return;
|
|
67870
67896
|
}
|
|
67871
67897
|
get size() {
|
|
67872
67898
|
let size = 0;
|
|
@@ -67877,6 +67903,32 @@ var InMemorySubscriptions = class {
|
|
|
67877
67903
|
}
|
|
67878
67904
|
return size;
|
|
67879
67905
|
}
|
|
67906
|
+
findSubSelections(parentID, selection, variables, searchTarget, selections = []) {
|
|
67907
|
+
const __typename = this.cache._internal_unstable.storage.get(parentID, "__typename").value;
|
|
67908
|
+
let targetSelection = getFieldsForType(selection, __typename, false);
|
|
67909
|
+
for (const fieldSelection of Object.values(targetSelection || {})) {
|
|
67910
|
+
if (!fieldSelection.selection) {
|
|
67911
|
+
continue;
|
|
67912
|
+
}
|
|
67913
|
+
const key = evaluateKey(fieldSelection.keyRaw, variables || {});
|
|
67914
|
+
const linkedRecord = this.cache._internal_unstable.storage.get(parentID, key);
|
|
67915
|
+
const links = !Array.isArray(linkedRecord.value) ? [linkedRecord.value] : flatten(linkedRecord.value);
|
|
67916
|
+
if (links.includes(searchTarget)) {
|
|
67917
|
+
selections.push(fieldSelection.selection);
|
|
67918
|
+
} else {
|
|
67919
|
+
for (const link of links) {
|
|
67920
|
+
this.findSubSelections(
|
|
67921
|
+
link,
|
|
67922
|
+
fieldSelection.selection,
|
|
67923
|
+
variables,
|
|
67924
|
+
searchTarget,
|
|
67925
|
+
selections
|
|
67926
|
+
);
|
|
67927
|
+
}
|
|
67928
|
+
}
|
|
67929
|
+
}
|
|
67930
|
+
return selections;
|
|
67931
|
+
}
|
|
67880
67932
|
};
|
|
67881
67933
|
|
|
67882
67934
|
// src/runtime/cache/cache.ts
|
|
@@ -67954,11 +68006,17 @@ var Cache = class {
|
|
|
67954
68006
|
}
|
|
67955
68007
|
registerKeyMap(source, mapped) {
|
|
67956
68008
|
this._internal_unstable.storage.registerIDMapping(source, mapped);
|
|
68009
|
+
this._internal_unstable.subscriptions.copySubscribers(source, mapped);
|
|
67957
68010
|
}
|
|
67958
68011
|
delete(id, layer) {
|
|
67959
|
-
this._internal_unstable.
|
|
67960
|
-
|
|
67961
|
-
|
|
68012
|
+
const recordIDs = [this._internal_unstable.storage.idMaps[id], id].filter(
|
|
68013
|
+
Boolean
|
|
68014
|
+
);
|
|
68015
|
+
for (const recordID of recordIDs) {
|
|
68016
|
+
this._internal_unstable.subscriptions.removeAllSubscribers(recordID);
|
|
68017
|
+
this._internal_unstable.lists.removeIDFromAllLists(recordID, layer);
|
|
68018
|
+
this._internal_unstable.storage.delete(recordID, layer);
|
|
68019
|
+
}
|
|
67962
68020
|
}
|
|
67963
68021
|
setConfig(config2) {
|
|
67964
68022
|
this._internal_unstable.setConfig(config2);
|
|
@@ -68264,6 +68322,9 @@ var CacheInternal = class {
|
|
|
68264
68322
|
layer,
|
|
68265
68323
|
forceNotify
|
|
68266
68324
|
});
|
|
68325
|
+
let action = () => {
|
|
68326
|
+
layer.writeLink(parent2, key, linkedIDs);
|
|
68327
|
+
};
|
|
68267
68328
|
if (applyUpdates && updates) {
|
|
68268
68329
|
if (key === "edges") {
|
|
68269
68330
|
const newNodeIDs = [];
|
|
@@ -68298,8 +68359,26 @@ var CacheInternal = class {
|
|
|
68298
68359
|
}
|
|
68299
68360
|
if (update === "prepend") {
|
|
68300
68361
|
linkedIDs = newIDs.concat(oldIDs);
|
|
68362
|
+
if (layer?.optimistic) {
|
|
68363
|
+
action = () => {
|
|
68364
|
+
for (const id of newIDs) {
|
|
68365
|
+
if (id) {
|
|
68366
|
+
layer.insert(parent2, key, "start", id);
|
|
68367
|
+
}
|
|
68368
|
+
}
|
|
68369
|
+
};
|
|
68370
|
+
}
|
|
68301
68371
|
} else if (update === "append") {
|
|
68302
68372
|
linkedIDs = oldIDs.concat(newIDs);
|
|
68373
|
+
if (layer?.optimistic) {
|
|
68374
|
+
action = () => {
|
|
68375
|
+
for (const id of newIDs) {
|
|
68376
|
+
if (id) {
|
|
68377
|
+
layer.insert(parent2, key, "end", id);
|
|
68378
|
+
}
|
|
68379
|
+
}
|
|
68380
|
+
};
|
|
68381
|
+
}
|
|
68303
68382
|
} else if (update === "replace") {
|
|
68304
68383
|
linkedIDs = newIDs;
|
|
68305
68384
|
}
|
|
@@ -68318,7 +68397,7 @@ var CacheInternal = class {
|
|
|
68318
68397
|
this.subscriptions.remove(lostID, fieldSelection, specs, variables);
|
|
68319
68398
|
}
|
|
68320
68399
|
if (contentChanged || oldIDs.length === 0 && newIDs.length === 0) {
|
|
68321
|
-
|
|
68400
|
+
action();
|
|
68322
68401
|
}
|
|
68323
68402
|
for (const id of newIDs.filter((id2) => !oldIDs.includes(id2))) {
|
|
68324
68403
|
if (id == null) {
|
|
@@ -68373,6 +68452,9 @@ var CacheInternal = class {
|
|
|
68373
68452
|
if (!targetID) {
|
|
68374
68453
|
continue;
|
|
68375
68454
|
}
|
|
68455
|
+
toNotify.push(
|
|
68456
|
+
...this.subscriptions.getAll(targetID).filter((sub) => sub[0].parentID !== targetID)
|
|
68457
|
+
);
|
|
68376
68458
|
this.cache.delete(targetID, layer);
|
|
68377
68459
|
}
|
|
68378
68460
|
}
|
|
@@ -68794,7 +68876,6 @@ function variableValue(value, args) {
|
|
|
68794
68876
|
);
|
|
68795
68877
|
}
|
|
68796
68878
|
}
|
|
68797
|
-
var rootID = "_ROOT_";
|
|
68798
68879
|
function defaultComponentField({
|
|
68799
68880
|
cache,
|
|
68800
68881
|
component,
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ConfigFile } from '../lib/config';
|
|
2
|
-
import type { Cache } from './cache';
|
|
3
|
-
export type TypeInfo = {
|
|
4
|
-
type: string;
|
|
5
|
-
nullable: boolean;
|
|
6
|
-
link: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare class SchemaManager {
|
|
9
|
-
cache: Cache;
|
|
10
|
-
fieldTypes: Record<string, Record<string, TypeInfo>>;
|
|
11
|
-
constructor(cache: Cache);
|
|
12
|
-
setFieldType({ parent, key, type, nullable, link, }: {
|
|
13
|
-
parent: string;
|
|
14
|
-
key: string;
|
|
15
|
-
type: string;
|
|
16
|
-
nullable?: boolean;
|
|
17
|
-
link?: boolean;
|
|
18
|
-
}): void;
|
|
19
|
-
fieldType(type: string, field: string): TypeInfo;
|
|
20
|
-
get config(): ConfigFile;
|
|
21
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ConfigFile } from '../lib/config';
|
|
2
|
-
import type { Cache } from './cache';
|
|
3
|
-
export type TypeInfo = {
|
|
4
|
-
type: string;
|
|
5
|
-
nullable: boolean;
|
|
6
|
-
link: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare class SchemaManager {
|
|
9
|
-
cache: Cache;
|
|
10
|
-
fieldTypes: Record<string, Record<string, TypeInfo>>;
|
|
11
|
-
constructor(cache: Cache);
|
|
12
|
-
setFieldType({ parent, key, type, nullable, link, }: {
|
|
13
|
-
parent: string;
|
|
14
|
-
key: string;
|
|
15
|
-
type: string;
|
|
16
|
-
nullable?: boolean;
|
|
17
|
-
link?: boolean;
|
|
18
|
-
}): void;
|
|
19
|
-
fieldType(type: string, field: string): TypeInfo;
|
|
20
|
-
get config(): ConfigFile;
|
|
21
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var schema_exports = {};
|
|
20
|
-
__export(schema_exports, {
|
|
21
|
-
SchemaManager: () => SchemaManager
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(schema_exports);
|
|
24
|
-
var import_cache = require("./cache");
|
|
25
|
-
class SchemaManager {
|
|
26
|
-
cache;
|
|
27
|
-
fieldTypes = {};
|
|
28
|
-
constructor(cache) {
|
|
29
|
-
this.cache = cache;
|
|
30
|
-
}
|
|
31
|
-
setFieldType({
|
|
32
|
-
parent,
|
|
33
|
-
key,
|
|
34
|
-
type,
|
|
35
|
-
nullable = false,
|
|
36
|
-
link
|
|
37
|
-
}) {
|
|
38
|
-
let parensIndex = key.indexOf("(");
|
|
39
|
-
if (parensIndex !== -1) {
|
|
40
|
-
key = key.substring(0, parensIndex);
|
|
41
|
-
}
|
|
42
|
-
if (parent === import_cache.rootID) {
|
|
43
|
-
parent = "Query";
|
|
44
|
-
} else if (parent.includes(":")) {
|
|
45
|
-
parent = parent.substring(0, parent.indexOf(":"));
|
|
46
|
-
}
|
|
47
|
-
if (!this.fieldTypes[parent]) {
|
|
48
|
-
this.fieldTypes[parent] = {};
|
|
49
|
-
}
|
|
50
|
-
this.fieldTypes[parent][key] = {
|
|
51
|
-
type,
|
|
52
|
-
nullable,
|
|
53
|
-
link: !!link
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
fieldType(type, field) {
|
|
57
|
-
return this.fieldTypes[type]?.[field] || null;
|
|
58
|
-
}
|
|
59
|
-
get config() {
|
|
60
|
-
return this.cache._internal_unstable.config;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
-
0 && (module.exports = {
|
|
65
|
-
SchemaManager
|
|
66
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ConfigFile } from '../lib/config';
|
|
2
|
-
import type { Cache } from './cache';
|
|
3
|
-
export type TypeInfo = {
|
|
4
|
-
type: string;
|
|
5
|
-
nullable: boolean;
|
|
6
|
-
link: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare class SchemaManager {
|
|
9
|
-
cache: Cache;
|
|
10
|
-
fieldTypes: Record<string, Record<string, TypeInfo>>;
|
|
11
|
-
constructor(cache: Cache);
|
|
12
|
-
setFieldType({ parent, key, type, nullable, link, }: {
|
|
13
|
-
parent: string;
|
|
14
|
-
key: string;
|
|
15
|
-
type: string;
|
|
16
|
-
nullable?: boolean;
|
|
17
|
-
link?: boolean;
|
|
18
|
-
}): void;
|
|
19
|
-
fieldType(type: string, field: string): TypeInfo;
|
|
20
|
-
get config(): ConfigFile;
|
|
21
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { rootID } from "./cache";
|
|
2
|
-
class SchemaManager {
|
|
3
|
-
cache;
|
|
4
|
-
fieldTypes = {};
|
|
5
|
-
constructor(cache) {
|
|
6
|
-
this.cache = cache;
|
|
7
|
-
}
|
|
8
|
-
setFieldType({
|
|
9
|
-
parent,
|
|
10
|
-
key,
|
|
11
|
-
type,
|
|
12
|
-
nullable = false,
|
|
13
|
-
link
|
|
14
|
-
}) {
|
|
15
|
-
let parensIndex = key.indexOf("(");
|
|
16
|
-
if (parensIndex !== -1) {
|
|
17
|
-
key = key.substring(0, parensIndex);
|
|
18
|
-
}
|
|
19
|
-
if (parent === rootID) {
|
|
20
|
-
parent = "Query";
|
|
21
|
-
} else if (parent.includes(":")) {
|
|
22
|
-
parent = parent.substring(0, parent.indexOf(":"));
|
|
23
|
-
}
|
|
24
|
-
if (!this.fieldTypes[parent]) {
|
|
25
|
-
this.fieldTypes[parent] = {};
|
|
26
|
-
}
|
|
27
|
-
this.fieldTypes[parent][key] = {
|
|
28
|
-
type,
|
|
29
|
-
nullable,
|
|
30
|
-
link: !!link
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
fieldType(type, field) {
|
|
34
|
-
return this.fieldTypes[type]?.[field] || null;
|
|
35
|
-
}
|
|
36
|
-
get config() {
|
|
37
|
-
return this.cache._internal_unstable.config;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
export {
|
|
41
|
-
SchemaManager
|
|
42
|
-
};
|