houdini 1.2.54 → 1.2.56
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 +142 -60
- package/build/cmd-esm/index.js +142 -60
- package/build/codegen-cjs/index.js +140 -58
- package/build/codegen-esm/index.js +140 -58
- package/build/lib-cjs/index.js +143 -59
- package/build/lib-esm/index.js +143 -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 +15 -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 +15 -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 +140 -58
- package/build/test-esm/index.js +140 -58
- package/build/vite-cjs/index.js +140 -58
- package/build/vite-esm/index.js +140 -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
|
}
|
|
@@ -67539,6 +67586,7 @@ var Layer = class {
|
|
|
67539
67586
|
[id]: {
|
|
67540
67587
|
...this.operations[id],
|
|
67541
67588
|
fields: {
|
|
67589
|
+
...this.operations[id]?.fields,
|
|
67542
67590
|
[field]: [...this.operations[id]?.fields[field] || [], operation]
|
|
67543
67591
|
}
|
|
67544
67592
|
}
|
|
@@ -67564,34 +67612,6 @@ var OperationKind = {
|
|
|
67564
67612
|
remove: "remove"
|
|
67565
67613
|
};
|
|
67566
67614
|
|
|
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
67615
|
// src/runtime/cache/subscription.ts
|
|
67596
67616
|
var InMemorySubscriptions = class {
|
|
67597
67617
|
cache;
|
|
@@ -67603,6 +67623,9 @@ var InMemorySubscriptions = class {
|
|
|
67603
67623
|
activeFields(parent2) {
|
|
67604
67624
|
return Object.keys(this.subscribers.get(parent2) || {});
|
|
67605
67625
|
}
|
|
67626
|
+
copySubscribers(from, to) {
|
|
67627
|
+
this.subscribers.set(to, this.subscribers.get(from) || /* @__PURE__ */ new Map());
|
|
67628
|
+
}
|
|
67606
67629
|
add({
|
|
67607
67630
|
parent: parent2,
|
|
67608
67631
|
spec,
|
|
@@ -67785,6 +67808,11 @@ var InMemorySubscriptions = class {
|
|
|
67785
67808
|
get(id, field) {
|
|
67786
67809
|
return this.subscribers.get(id)?.get(field)?.selections || [];
|
|
67787
67810
|
}
|
|
67811
|
+
getAll(id) {
|
|
67812
|
+
return [...this.subscribers.get(id)?.values() || []].flatMap(
|
|
67813
|
+
(fieldSub) => fieldSub.selections
|
|
67814
|
+
);
|
|
67815
|
+
}
|
|
67788
67816
|
remove(id, selection, targets, variables, visited = []) {
|
|
67789
67817
|
visited.push(id);
|
|
67790
67818
|
const linkedIDs = [];
|
|
@@ -67826,7 +67854,7 @@ var InMemorySubscriptions = class {
|
|
|
67826
67854
|
}
|
|
67827
67855
|
const subscriberField = subscriber.get(fieldName);
|
|
67828
67856
|
for (const spec of specs) {
|
|
67829
|
-
const counts =
|
|
67857
|
+
const counts = subscriberField?.referenceCounts;
|
|
67830
67858
|
if (!counts?.has(spec.set)) {
|
|
67831
67859
|
continue;
|
|
67832
67860
|
}
|
|
@@ -67849,24 +67877,23 @@ var InMemorySubscriptions = class {
|
|
|
67849
67877
|
this.subscribers.delete(id);
|
|
67850
67878
|
}
|
|
67851
67879
|
}
|
|
67852
|
-
removeAllSubscribers(id, targets
|
|
67853
|
-
|
|
67854
|
-
|
|
67855
|
-
|
|
67856
|
-
|
|
67857
|
-
|
|
67858
|
-
|
|
67859
|
-
|
|
67860
|
-
|
|
67861
|
-
|
|
67862
|
-
|
|
67863
|
-
|
|
67864
|
-
|
|
67865
|
-
|
|
67866
|
-
}
|
|
67867
|
-
this.removeAllSubscribers(id2, subscribers, visited);
|
|
67880
|
+
removeAllSubscribers(id, targets) {
|
|
67881
|
+
if (!targets) {
|
|
67882
|
+
targets = [...this.subscribers.get(id)?.values() || []].flatMap(
|
|
67883
|
+
(spec) => spec.selections.flatMap((sel) => sel[0])
|
|
67884
|
+
);
|
|
67885
|
+
}
|
|
67886
|
+
for (const target of targets) {
|
|
67887
|
+
for (const subselection of this.findSubSelections(
|
|
67888
|
+
target.parentID || rootID,
|
|
67889
|
+
target.selection,
|
|
67890
|
+
target.variables || {},
|
|
67891
|
+
id
|
|
67892
|
+
)) {
|
|
67893
|
+
this.remove(id, subselection, targets, target.variables || {});
|
|
67868
67894
|
}
|
|
67869
67895
|
}
|
|
67896
|
+
return;
|
|
67870
67897
|
}
|
|
67871
67898
|
get size() {
|
|
67872
67899
|
let size = 0;
|
|
@@ -67877,6 +67904,32 @@ var InMemorySubscriptions = class {
|
|
|
67877
67904
|
}
|
|
67878
67905
|
return size;
|
|
67879
67906
|
}
|
|
67907
|
+
findSubSelections(parentID, selection, variables, searchTarget, selections = []) {
|
|
67908
|
+
const __typename = this.cache._internal_unstable.storage.get(parentID, "__typename").value;
|
|
67909
|
+
let targetSelection = getFieldsForType(selection, __typename, false);
|
|
67910
|
+
for (const fieldSelection of Object.values(targetSelection || {})) {
|
|
67911
|
+
if (!fieldSelection.selection) {
|
|
67912
|
+
continue;
|
|
67913
|
+
}
|
|
67914
|
+
const key = evaluateKey(fieldSelection.keyRaw, variables || {});
|
|
67915
|
+
const linkedRecord = this.cache._internal_unstable.storage.get(parentID, key);
|
|
67916
|
+
const links = !Array.isArray(linkedRecord.value) ? [linkedRecord.value] : flatten(linkedRecord.value);
|
|
67917
|
+
if (links.includes(searchTarget)) {
|
|
67918
|
+
selections.push(fieldSelection.selection);
|
|
67919
|
+
} else {
|
|
67920
|
+
for (const link of links) {
|
|
67921
|
+
this.findSubSelections(
|
|
67922
|
+
link,
|
|
67923
|
+
fieldSelection.selection,
|
|
67924
|
+
variables,
|
|
67925
|
+
searchTarget,
|
|
67926
|
+
selections
|
|
67927
|
+
);
|
|
67928
|
+
}
|
|
67929
|
+
}
|
|
67930
|
+
}
|
|
67931
|
+
return selections;
|
|
67932
|
+
}
|
|
67880
67933
|
};
|
|
67881
67934
|
|
|
67882
67935
|
// src/runtime/cache/cache.ts
|
|
@@ -67954,11 +68007,17 @@ var Cache = class {
|
|
|
67954
68007
|
}
|
|
67955
68008
|
registerKeyMap(source, mapped) {
|
|
67956
68009
|
this._internal_unstable.storage.registerIDMapping(source, mapped);
|
|
68010
|
+
this._internal_unstable.subscriptions.copySubscribers(source, mapped);
|
|
67957
68011
|
}
|
|
67958
68012
|
delete(id, layer) {
|
|
67959
|
-
this._internal_unstable.
|
|
67960
|
-
|
|
67961
|
-
|
|
68013
|
+
const recordIDs = [this._internal_unstable.storage.idMaps[id], id].filter(
|
|
68014
|
+
Boolean
|
|
68015
|
+
);
|
|
68016
|
+
for (const recordID of recordIDs) {
|
|
68017
|
+
this._internal_unstable.subscriptions.removeAllSubscribers(recordID);
|
|
68018
|
+
this._internal_unstable.lists.removeIDFromAllLists(recordID, layer);
|
|
68019
|
+
this._internal_unstable.storage.delete(recordID, layer);
|
|
68020
|
+
}
|
|
67962
68021
|
}
|
|
67963
68022
|
setConfig(config2) {
|
|
67964
68023
|
this._internal_unstable.setConfig(config2);
|
|
@@ -68264,6 +68323,9 @@ var CacheInternal = class {
|
|
|
68264
68323
|
layer,
|
|
68265
68324
|
forceNotify
|
|
68266
68325
|
});
|
|
68326
|
+
let action = () => {
|
|
68327
|
+
layer.writeLink(parent2, key, linkedIDs);
|
|
68328
|
+
};
|
|
68267
68329
|
if (applyUpdates && updates) {
|
|
68268
68330
|
if (key === "edges") {
|
|
68269
68331
|
const newNodeIDs = [];
|
|
@@ -68298,8 +68360,26 @@ var CacheInternal = class {
|
|
|
68298
68360
|
}
|
|
68299
68361
|
if (update === "prepend") {
|
|
68300
68362
|
linkedIDs = newIDs.concat(oldIDs);
|
|
68363
|
+
if (layer?.optimistic) {
|
|
68364
|
+
action = () => {
|
|
68365
|
+
for (const id of newIDs) {
|
|
68366
|
+
if (id) {
|
|
68367
|
+
layer.insert(parent2, key, "start", id);
|
|
68368
|
+
}
|
|
68369
|
+
}
|
|
68370
|
+
};
|
|
68371
|
+
}
|
|
68301
68372
|
} else if (update === "append") {
|
|
68302
68373
|
linkedIDs = oldIDs.concat(newIDs);
|
|
68374
|
+
if (layer?.optimistic) {
|
|
68375
|
+
action = () => {
|
|
68376
|
+
for (const id of newIDs) {
|
|
68377
|
+
if (id) {
|
|
68378
|
+
layer.insert(parent2, key, "end", id);
|
|
68379
|
+
}
|
|
68380
|
+
}
|
|
68381
|
+
};
|
|
68382
|
+
}
|
|
68303
68383
|
} else if (update === "replace") {
|
|
68304
68384
|
linkedIDs = newIDs;
|
|
68305
68385
|
}
|
|
@@ -68318,7 +68398,7 @@ var CacheInternal = class {
|
|
|
68318
68398
|
this.subscriptions.remove(lostID, fieldSelection, specs, variables);
|
|
68319
68399
|
}
|
|
68320
68400
|
if (contentChanged || oldIDs.length === 0 && newIDs.length === 0) {
|
|
68321
|
-
|
|
68401
|
+
action();
|
|
68322
68402
|
}
|
|
68323
68403
|
for (const id of newIDs.filter((id2) => !oldIDs.includes(id2))) {
|
|
68324
68404
|
if (id == null) {
|
|
@@ -68373,6 +68453,9 @@ var CacheInternal = class {
|
|
|
68373
68453
|
if (!targetID) {
|
|
68374
68454
|
continue;
|
|
68375
68455
|
}
|
|
68456
|
+
toNotify.push(
|
|
68457
|
+
...this.subscriptions.getAll(targetID).filter((sub) => sub[0].parentID !== targetID)
|
|
68458
|
+
);
|
|
68376
68459
|
this.cache.delete(targetID, layer);
|
|
68377
68460
|
}
|
|
68378
68461
|
}
|
|
@@ -68794,7 +68877,6 @@ function variableValue(value, args) {
|
|
|
68794
68877
|
);
|
|
68795
68878
|
}
|
|
68796
68879
|
}
|
|
68797
|
-
var rootID = "_ROOT_";
|
|
68798
68880
|
function defaultComponentField({
|
|
68799
68881
|
cache,
|
|
68800
68882
|
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
|
-
};
|