fragment-dev 1.1.4 → 1.1.5
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.
- checksums.yaml +4 -4
- data/lib/fragment.schema.json +323 -19
- data/lib/fragment_client/version.rb +1 -1
- data/lib/fragment_client.rb +98 -34
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14ed3fb9c939a656c86ce4ce587c6e778302ba33e112e6d8363fc2ed8a791ee0
|
4
|
+
data.tar.gz: 61f1af6ee1cff1309ad207ff9bcfe0ae07a4903e17fd8cf025a111dda7bdc0f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f9acc9a93ef576b8358fa082df9f2a38afd716b0b0ad1cb429469761e3ef7090f57c5fe0ae8db8535f6c8abe147fc442e82db99058ff989cb4a3041f497a308
|
7
|
+
data.tar.gz: 400e3b64573ac550667baf79edec6e53452c05cc489fc7d3613063ccbf69bd6ab08b9005d4b069d5b8f09d0b3185085d05b013b78a222cc5a2f8fd42a66924e3
|
data/lib/fragment.schema.json
CHANGED
@@ -184,20 +184,20 @@
|
|
184
184
|
{
|
185
185
|
"kind": "ENUM",
|
186
186
|
"name": "BalanceUpdateConsistencyMode",
|
187
|
-
"description": "Used to configure the write-consistency of a Ledger Account's balance
|
187
|
+
"description": "Used to configure the write-consistency of a Ledger Account's balance. See [Configure consistency](https://fragment.dev/docs#configure-consistency).",
|
188
188
|
"fields": null,
|
189
189
|
"inputFields": null,
|
190
190
|
"interfaces": null,
|
191
191
|
"enumValues": [
|
192
192
|
{
|
193
193
|
"name": "eventual",
|
194
|
-
"description":
|
194
|
+
"description": null,
|
195
195
|
"isDeprecated": false,
|
196
196
|
"deprecationReason": null
|
197
197
|
},
|
198
198
|
{
|
199
199
|
"name": "strong",
|
200
|
-
"description":
|
200
|
+
"description": null,
|
201
201
|
"isDeprecated": false,
|
202
202
|
"deprecationReason": null
|
203
203
|
}
|
@@ -460,8 +460,8 @@
|
|
460
460
|
"kind": "NON_NULL",
|
461
461
|
"name": null,
|
462
462
|
"ofType": {
|
463
|
-
"kind": "
|
464
|
-
"name": "
|
463
|
+
"kind": "OBJECT",
|
464
|
+
"name": "CustomLink",
|
465
465
|
"ofType": null
|
466
466
|
}
|
467
467
|
},
|
@@ -2727,6 +2727,120 @@
|
|
2727
2727
|
"enumValues": null,
|
2728
2728
|
"possibleTypes": null
|
2729
2729
|
},
|
2730
|
+
{
|
2731
|
+
"kind": "UNION",
|
2732
|
+
"name": "DeleteLedgerResponse",
|
2733
|
+
"description": null,
|
2734
|
+
"fields": null,
|
2735
|
+
"inputFields": null,
|
2736
|
+
"interfaces": null,
|
2737
|
+
"enumValues": null,
|
2738
|
+
"possibleTypes": [
|
2739
|
+
{
|
2740
|
+
"kind": "OBJECT",
|
2741
|
+
"name": "BadRequestError",
|
2742
|
+
"ofType": null
|
2743
|
+
},
|
2744
|
+
{
|
2745
|
+
"kind": "OBJECT",
|
2746
|
+
"name": "DeleteLedgerResult",
|
2747
|
+
"ofType": null
|
2748
|
+
},
|
2749
|
+
{
|
2750
|
+
"kind": "OBJECT",
|
2751
|
+
"name": "InternalError",
|
2752
|
+
"ofType": null
|
2753
|
+
}
|
2754
|
+
]
|
2755
|
+
},
|
2756
|
+
{
|
2757
|
+
"kind": "OBJECT",
|
2758
|
+
"name": "DeleteLedgerResult",
|
2759
|
+
"description": null,
|
2760
|
+
"fields": [
|
2761
|
+
{
|
2762
|
+
"name": "success",
|
2763
|
+
"description": null,
|
2764
|
+
"args": [
|
2765
|
+
|
2766
|
+
],
|
2767
|
+
"type": {
|
2768
|
+
"kind": "NON_NULL",
|
2769
|
+
"name": null,
|
2770
|
+
"ofType": {
|
2771
|
+
"kind": "SCALAR",
|
2772
|
+
"name": "Boolean",
|
2773
|
+
"ofType": null
|
2774
|
+
}
|
2775
|
+
},
|
2776
|
+
"isDeprecated": false,
|
2777
|
+
"deprecationReason": null
|
2778
|
+
}
|
2779
|
+
],
|
2780
|
+
"inputFields": null,
|
2781
|
+
"interfaces": [
|
2782
|
+
|
2783
|
+
],
|
2784
|
+
"enumValues": null,
|
2785
|
+
"possibleTypes": null
|
2786
|
+
},
|
2787
|
+
{
|
2788
|
+
"kind": "UNION",
|
2789
|
+
"name": "DeleteSchemaResponse",
|
2790
|
+
"description": null,
|
2791
|
+
"fields": null,
|
2792
|
+
"inputFields": null,
|
2793
|
+
"interfaces": null,
|
2794
|
+
"enumValues": null,
|
2795
|
+
"possibleTypes": [
|
2796
|
+
{
|
2797
|
+
"kind": "OBJECT",
|
2798
|
+
"name": "BadRequestError",
|
2799
|
+
"ofType": null
|
2800
|
+
},
|
2801
|
+
{
|
2802
|
+
"kind": "OBJECT",
|
2803
|
+
"name": "DeleteSchemaResult",
|
2804
|
+
"ofType": null
|
2805
|
+
},
|
2806
|
+
{
|
2807
|
+
"kind": "OBJECT",
|
2808
|
+
"name": "InternalError",
|
2809
|
+
"ofType": null
|
2810
|
+
}
|
2811
|
+
]
|
2812
|
+
},
|
2813
|
+
{
|
2814
|
+
"kind": "OBJECT",
|
2815
|
+
"name": "DeleteSchemaResult",
|
2816
|
+
"description": null,
|
2817
|
+
"fields": [
|
2818
|
+
{
|
2819
|
+
"name": "success",
|
2820
|
+
"description": null,
|
2821
|
+
"args": [
|
2822
|
+
|
2823
|
+
],
|
2824
|
+
"type": {
|
2825
|
+
"kind": "NON_NULL",
|
2826
|
+
"name": null,
|
2827
|
+
"ofType": {
|
2828
|
+
"kind": "SCALAR",
|
2829
|
+
"name": "Boolean",
|
2830
|
+
"ofType": null
|
2831
|
+
}
|
2832
|
+
},
|
2833
|
+
"isDeprecated": false,
|
2834
|
+
"deprecationReason": null
|
2835
|
+
}
|
2836
|
+
],
|
2837
|
+
"inputFields": null,
|
2838
|
+
"interfaces": [
|
2839
|
+
|
2840
|
+
],
|
2841
|
+
"enumValues": null,
|
2842
|
+
"possibleTypes": null
|
2843
|
+
},
|
2730
2844
|
{
|
2731
2845
|
"kind": "INPUT_OBJECT",
|
2732
2846
|
"name": "EntryGroupMatchInput",
|
@@ -3140,7 +3254,7 @@
|
|
3140
3254
|
{
|
3141
3255
|
"kind": "INPUT_OBJECT",
|
3142
3256
|
"name": "ExternalAccountMatchInput",
|
3143
|
-
"description": "Specify an External Account by using `id`, or
|
3257
|
+
"description": "Specify an External Account by using `id`, or `linkId` and `externalId`.",
|
3144
3258
|
"fields": null,
|
3145
3259
|
"inputFields": [
|
3146
3260
|
{
|
@@ -5333,7 +5447,7 @@
|
|
5333
5447
|
"inputFields": [
|
5334
5448
|
{
|
5335
5449
|
"name": "id",
|
5336
|
-
"description": "The FRAGMENT ID of the
|
5450
|
+
"description": "The FRAGMENT ID of the Ledger Account",
|
5337
5451
|
"type": {
|
5338
5452
|
"kind": "SCALAR",
|
5339
5453
|
"name": "ID",
|
@@ -5353,7 +5467,7 @@
|
|
5353
5467
|
},
|
5354
5468
|
{
|
5355
5469
|
"name": "path",
|
5356
|
-
"description": "The unique path of the
|
5470
|
+
"description": "The unique path of the Ledger Account.\nThis is a slash-delimited string containing the keys of an account and all its direct ancestors.",
|
5357
5471
|
"type": {
|
5358
5472
|
"kind": "SCALAR",
|
5359
5473
|
"name": "String",
|
@@ -5911,6 +6025,20 @@
|
|
5911
6025
|
"isDeprecated": false,
|
5912
6026
|
"deprecationReason": null
|
5913
6027
|
},
|
6028
|
+
{
|
6029
|
+
"name": "parameters",
|
6030
|
+
"description": "The parameters used to post this Ledger Entry.",
|
6031
|
+
"args": [
|
6032
|
+
|
6033
|
+
],
|
6034
|
+
"type": {
|
6035
|
+
"kind": "SCALAR",
|
6036
|
+
"name": "Parameters",
|
6037
|
+
"ofType": null
|
6038
|
+
},
|
6039
|
+
"isDeprecated": false,
|
6040
|
+
"deprecationReason": null
|
6041
|
+
},
|
5914
6042
|
{
|
5915
6043
|
"name": "posted",
|
5916
6044
|
"description": "ISO-8601 timestamp this LedgerEntry posted to its Ledger.",
|
@@ -6252,6 +6380,24 @@
|
|
6252
6380
|
"isDeprecated": false,
|
6253
6381
|
"deprecationReason": null
|
6254
6382
|
},
|
6383
|
+
{
|
6384
|
+
"name": "dashboardUrl",
|
6385
|
+
"description": "URL to the Fragment Dashboard for this Ledger Entry Group.",
|
6386
|
+
"args": [
|
6387
|
+
|
6388
|
+
],
|
6389
|
+
"type": {
|
6390
|
+
"kind": "NON_NULL",
|
6391
|
+
"name": null,
|
6392
|
+
"ofType": {
|
6393
|
+
"kind": "SCALAR",
|
6394
|
+
"name": "String",
|
6395
|
+
"ofType": null
|
6396
|
+
}
|
6397
|
+
},
|
6398
|
+
"isDeprecated": false,
|
6399
|
+
"deprecationReason": null
|
6400
|
+
},
|
6255
6401
|
{
|
6256
6402
|
"name": "key",
|
6257
6403
|
"description": "The key of this Ledger Entry Group.",
|
@@ -6270,6 +6416,24 @@
|
|
6270
6416
|
"isDeprecated": false,
|
6271
6417
|
"deprecationReason": null
|
6272
6418
|
},
|
6419
|
+
{
|
6420
|
+
"name": "ledger",
|
6421
|
+
"description": "The Ledger that this Ledger Entry Group is within.",
|
6422
|
+
"args": [
|
6423
|
+
|
6424
|
+
],
|
6425
|
+
"type": {
|
6426
|
+
"kind": "NON_NULL",
|
6427
|
+
"name": null,
|
6428
|
+
"ofType": {
|
6429
|
+
"kind": "OBJECT",
|
6430
|
+
"name": "Ledger",
|
6431
|
+
"ofType": null
|
6432
|
+
}
|
6433
|
+
},
|
6434
|
+
"isDeprecated": false,
|
6435
|
+
"deprecationReason": null
|
6436
|
+
},
|
6273
6437
|
{
|
6274
6438
|
"name": "ledgerEntries",
|
6275
6439
|
"description": null,
|
@@ -6337,6 +6501,24 @@
|
|
6337
6501
|
"isDeprecated": false,
|
6338
6502
|
"deprecationReason": null
|
6339
6503
|
},
|
6504
|
+
{
|
6505
|
+
"name": "ledgerId",
|
6506
|
+
"description": "The ID of the Ledger this Ledger Entry Group is within.",
|
6507
|
+
"args": [
|
6508
|
+
|
6509
|
+
],
|
6510
|
+
"type": {
|
6511
|
+
"kind": "NON_NULL",
|
6512
|
+
"name": null,
|
6513
|
+
"ofType": {
|
6514
|
+
"kind": "SCALAR",
|
6515
|
+
"name": "ID",
|
6516
|
+
"ofType": null
|
6517
|
+
}
|
6518
|
+
},
|
6519
|
+
"isDeprecated": false,
|
6520
|
+
"deprecationReason": null
|
6521
|
+
},
|
6340
6522
|
{
|
6341
6523
|
"name": "value",
|
6342
6524
|
"description": "The value associated with Ledger Entry Group.",
|
@@ -6694,7 +6876,7 @@
|
|
6694
6876
|
"inputFields": [
|
6695
6877
|
{
|
6696
6878
|
"name": "created",
|
6697
|
-
"description": "Use to filter
|
6879
|
+
"description": "Use to filter Ledger Entry Groups by their created timestamp",
|
6698
6880
|
"type": {
|
6699
6881
|
"kind": "INPUT_OBJECT",
|
6700
6882
|
"name": "DateTimeFilter",
|
@@ -6704,7 +6886,17 @@
|
|
6704
6886
|
},
|
6705
6887
|
{
|
6706
6888
|
"name": "key",
|
6707
|
-
"description": "Use to filter
|
6889
|
+
"description": "Use to filter Ledger Entry Groups by their key",
|
6890
|
+
"type": {
|
6891
|
+
"kind": "INPUT_OBJECT",
|
6892
|
+
"name": "StringFilter",
|
6893
|
+
"ofType": null
|
6894
|
+
},
|
6895
|
+
"defaultValue": null
|
6896
|
+
},
|
6897
|
+
{
|
6898
|
+
"name": "value",
|
6899
|
+
"description": "Use to filter Ledger Entry Groups by their value",
|
6708
6900
|
"type": {
|
6709
6901
|
"kind": "INPUT_OBJECT",
|
6710
6902
|
"name": "StringFilter",
|
@@ -6844,6 +7036,16 @@
|
|
6844
7036
|
"ofType": null
|
6845
7037
|
},
|
6846
7038
|
"defaultValue": null
|
7039
|
+
},
|
7040
|
+
{
|
7041
|
+
"name": "version",
|
7042
|
+
"description": "Experimental: This field is reserved for an upcoming feature and is not yet supported.",
|
7043
|
+
"type": {
|
7044
|
+
"kind": "SCALAR",
|
7045
|
+
"name": "Int",
|
7046
|
+
"ofType": null
|
7047
|
+
},
|
7048
|
+
"defaultValue": null
|
6847
7049
|
}
|
6848
7050
|
],
|
6849
7051
|
"interfaces": null,
|
@@ -6868,7 +7070,7 @@
|
|
6868
7070
|
},
|
6869
7071
|
{
|
6870
7072
|
"name": "ik",
|
6871
|
-
"description": "The IK provided to the `addLedgerEntry` mutation or the `ik` field
|
7073
|
+
"description": "The IK provided to the `addLedgerEntry` mutation or the `ik` field returned from a `reconcileTx` mutation. This is required if you have not provided `id`.",
|
6872
7074
|
"type": {
|
6873
7075
|
"kind": "SCALAR",
|
6874
7076
|
"name": "SafeString",
|
@@ -6878,7 +7080,7 @@
|
|
6878
7080
|
},
|
6879
7081
|
{
|
6880
7082
|
"name": "ledger",
|
6881
|
-
"description": "The FRAGMENT ID of the Ledger to which this Ledger Entry belongs. This
|
7083
|
+
"description": "The FRAGMENT ID of the Ledger to which this Ledger Entry belongs. This is required if you have not provided `id`.",
|
6882
7084
|
"type": {
|
6883
7085
|
"kind": "INPUT_OBJECT",
|
6884
7086
|
"name": "LedgerMatchInput",
|
@@ -7569,9 +7771,19 @@
|
|
7569
7771
|
"description": null,
|
7570
7772
|
"fields": null,
|
7571
7773
|
"inputFields": [
|
7774
|
+
{
|
7775
|
+
"name": "created",
|
7776
|
+
"description": "Filter by the created timestamp of the Ledger Line. This is the wall-clock time when the Ledger Line was created.",
|
7777
|
+
"type": {
|
7778
|
+
"kind": "INPUT_OBJECT",
|
7779
|
+
"name": "DateTimeFilter",
|
7780
|
+
"ofType": null
|
7781
|
+
},
|
7782
|
+
"defaultValue": null
|
7783
|
+
},
|
7572
7784
|
{
|
7573
7785
|
"name": "date",
|
7574
|
-
"description":
|
7786
|
+
"description": "Filter by the posted date of the Ledger Line. This is identical to using `posted`, but only supports day-level granularity.",
|
7575
7787
|
"type": {
|
7576
7788
|
"kind": "INPUT_OBJECT",
|
7577
7789
|
"name": "DateFilter",
|
@@ -7591,7 +7803,7 @@
|
|
7591
7803
|
},
|
7592
7804
|
{
|
7593
7805
|
"name": "posted",
|
7594
|
-
"description":
|
7806
|
+
"description": "Filter by the posted timestamp of the Ledger Line.",
|
7595
7807
|
"type": {
|
7596
7808
|
"kind": "INPUT_OBJECT",
|
7597
7809
|
"name": "DateTimeFilter",
|
@@ -7622,7 +7834,7 @@
|
|
7622
7834
|
"inputFields": [
|
7623
7835
|
{
|
7624
7836
|
"name": "id",
|
7625
|
-
"description": "The FRAGMENT ID of the
|
7837
|
+
"description": "The FRAGMENT ID of the Ledger",
|
7626
7838
|
"type": {
|
7627
7839
|
"kind": "SCALAR",
|
7628
7840
|
"name": "ID",
|
@@ -7632,7 +7844,7 @@
|
|
7632
7844
|
},
|
7633
7845
|
{
|
7634
7846
|
"name": "ik",
|
7635
|
-
"description": "The IK passed into the [createLedger](/api-reference#mutations-createledger) mutation. This is treated as a second unique identifier for this
|
7847
|
+
"description": "The IK passed into the [createLedger](/api-reference#mutations-createledger) mutation. This is treated as a second unique identifier for this Ledger.",
|
7636
7848
|
"type": {
|
7637
7849
|
"kind": "SCALAR",
|
7638
7850
|
"name": "SafeString",
|
@@ -8467,6 +8679,68 @@
|
|
8467
8679
|
"isDeprecated": false,
|
8468
8680
|
"deprecationReason": null
|
8469
8681
|
},
|
8682
|
+
{
|
8683
|
+
"name": "deleteLedger",
|
8684
|
+
"description": "Delete a Ledger",
|
8685
|
+
"args": [
|
8686
|
+
{
|
8687
|
+
"name": "ledger",
|
8688
|
+
"description": null,
|
8689
|
+
"type": {
|
8690
|
+
"kind": "NON_NULL",
|
8691
|
+
"name": null,
|
8692
|
+
"ofType": {
|
8693
|
+
"kind": "INPUT_OBJECT",
|
8694
|
+
"name": "LedgerMatchInput",
|
8695
|
+
"ofType": null
|
8696
|
+
}
|
8697
|
+
},
|
8698
|
+
"defaultValue": null
|
8699
|
+
}
|
8700
|
+
],
|
8701
|
+
"type": {
|
8702
|
+
"kind": "NON_NULL",
|
8703
|
+
"name": null,
|
8704
|
+
"ofType": {
|
8705
|
+
"kind": "UNION",
|
8706
|
+
"name": "DeleteLedgerResponse",
|
8707
|
+
"ofType": null
|
8708
|
+
}
|
8709
|
+
},
|
8710
|
+
"isDeprecated": false,
|
8711
|
+
"deprecationReason": null
|
8712
|
+
},
|
8713
|
+
{
|
8714
|
+
"name": "deleteSchema",
|
8715
|
+
"description": "Delete a Schema",
|
8716
|
+
"args": [
|
8717
|
+
{
|
8718
|
+
"name": "schema",
|
8719
|
+
"description": null,
|
8720
|
+
"type": {
|
8721
|
+
"kind": "NON_NULL",
|
8722
|
+
"name": null,
|
8723
|
+
"ofType": {
|
8724
|
+
"kind": "INPUT_OBJECT",
|
8725
|
+
"name": "SchemaMatchInput",
|
8726
|
+
"ofType": null
|
8727
|
+
}
|
8728
|
+
},
|
8729
|
+
"defaultValue": null
|
8730
|
+
}
|
8731
|
+
],
|
8732
|
+
"type": {
|
8733
|
+
"kind": "NON_NULL",
|
8734
|
+
"name": null,
|
8735
|
+
"ofType": {
|
8736
|
+
"kind": "UNION",
|
8737
|
+
"name": "DeleteSchemaResponse",
|
8738
|
+
"ofType": null
|
8739
|
+
}
|
8740
|
+
},
|
8741
|
+
"isDeprecated": false,
|
8742
|
+
"deprecationReason": null
|
8743
|
+
},
|
8470
8744
|
{
|
8471
8745
|
"name": "reconcileTx",
|
8472
8746
|
"description": "This mutation is used to [reconcile](https://fragment.dev/docs#reconcile-transactions) transactions from an external system into a Ledger Entry. This mutation does not require an idempotency key since a transaction can only be reconciled once per Linked Ledger Account. If you are reconciling a transfer between two Link Accounts which are both linked to the same Ledger, use a transit account in between to split the transfer into two `reconcileTx` calls.",
|
@@ -8936,6 +9210,16 @@
|
|
8936
9210
|
"enumValues": null,
|
8937
9211
|
"possibleTypes": null
|
8938
9212
|
},
|
9213
|
+
{
|
9214
|
+
"kind": "SCALAR",
|
9215
|
+
"name": "Parameters",
|
9216
|
+
"description": "A mapping of parameter keys to values.",
|
9217
|
+
"fields": null,
|
9218
|
+
"inputFields": null,
|
9219
|
+
"interfaces": null,
|
9220
|
+
"enumValues": null,
|
9221
|
+
"possibleTypes": null
|
9222
|
+
},
|
8939
9223
|
{
|
8940
9224
|
"kind": "SCALAR",
|
8941
9225
|
"name": "Period",
|
@@ -9436,14 +9720,14 @@
|
|
9436
9720
|
{
|
9437
9721
|
"kind": "ENUM",
|
9438
9722
|
"name": "ReadBalanceConsistencyMode",
|
9439
|
-
"description": "The consistency configuration of a Ledger Account's balance queries
|
9723
|
+
"description": "The consistency configuration of a Ledger Account's balance queries. If not provided as an argument to a balance query, the default behavior is to read eventually consistent balances. See [Configure consistency](https://fragment.dev/docs#configure-consistency).",
|
9440
9724
|
"fields": null,
|
9441
9725
|
"inputFields": null,
|
9442
9726
|
"interfaces": null,
|
9443
9727
|
"enumValues": [
|
9444
9728
|
{
|
9445
9729
|
"name": "eventual",
|
9446
|
-
"description": "Balance queries will read eventually consistent balances. This is the default behavior if `ReadBalanceConsistencyMode` is not provided as an argument to the balance field
|
9730
|
+
"description": "Balance queries will read eventually consistent balances. This is the default behavior if `ReadBalanceConsistencyMode` is not provided as an argument to the balance field. Both Ledger Accounts configured with strongly and eventually consistent balance updates support this enum.",
|
9447
9731
|
"isDeprecated": false,
|
9448
9732
|
"deprecationReason": null
|
9449
9733
|
},
|
@@ -10603,6 +10887,16 @@
|
|
10603
10887
|
}
|
10604
10888
|
},
|
10605
10889
|
"defaultValue": null
|
10890
|
+
},
|
10891
|
+
{
|
10892
|
+
"name": "version",
|
10893
|
+
"description": "Experimental: This field is not yet supported.",
|
10894
|
+
"type": {
|
10895
|
+
"kind": "SCALAR",
|
10896
|
+
"name": "Int",
|
10897
|
+
"ofType": null
|
10898
|
+
},
|
10899
|
+
"defaultValue": null
|
10606
10900
|
}
|
10607
10901
|
],
|
10608
10902
|
"interfaces": null,
|
@@ -10749,7 +11043,7 @@
|
|
10749
11043
|
},
|
10750
11044
|
{
|
10751
11045
|
"name": "version",
|
10752
|
-
"description": "Optional parameter to specify version of requested Schema. If not provided, it defaults to 0
|
11046
|
+
"description": "Optional parameter to specify version of requested Schema. If not provided, it defaults to 0, representing the latest available version for the provided Schema key.",
|
10753
11047
|
"type": {
|
10754
11048
|
"kind": "SCALAR",
|
10755
11049
|
"name": "Int",
|
@@ -11047,6 +11341,16 @@
|
|
11047
11341
|
"description": null,
|
11048
11342
|
"fields": null,
|
11049
11343
|
"inputFields": [
|
11344
|
+
{
|
11345
|
+
"name": "contains",
|
11346
|
+
"description": "Must contain the provided pattern somewhere within the string. For example, 'contains: hat' will match 'hat', 'chat', and 'hate'.",
|
11347
|
+
"type": {
|
11348
|
+
"kind": "SCALAR",
|
11349
|
+
"name": "String",
|
11350
|
+
"ofType": null
|
11351
|
+
},
|
11352
|
+
"defaultValue": null
|
11353
|
+
},
|
11050
11354
|
{
|
11051
11355
|
"name": "equalTo",
|
11052
11356
|
"description": "Must exactly equal the provided value",
|
data/lib/fragment_client.rb
CHANGED
@@ -9,33 +9,23 @@ require 'uri'
|
|
9
9
|
require 'net/http'
|
10
10
|
require 'fragment_client/version'
|
11
11
|
|
12
|
-
module GraphQL
|
13
|
-
module StaticValidation
|
14
|
-
class LiteralValidator
|
15
|
-
alias recursive_validate_old recursively_validate
|
16
|
-
def recursively_validate(ast_value, type)
|
17
|
-
res = catch(:invalid) do
|
18
|
-
recursive_validate_old(ast_value, type)
|
19
|
-
end
|
20
|
-
if !res.valid? && type.kind.scalar? && ast_value.is_a?(GraphQL::Language::Nodes::InputObject)
|
21
|
-
maybe_raise_if_invalid(ast_value) do
|
22
|
-
['JSON', 'JSONObject', 'Any'].include?(type.graphql_name) ? @valid_response : @invalid_response
|
23
|
-
end
|
24
|
-
else
|
25
|
-
res
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
class Client
|
32
|
-
# A monkey patch to change the definition name
|
33
|
-
class Definition
|
34
|
-
alias old_definition_name definition_name
|
35
|
-
def definition_name
|
36
|
-
old_definition_name.gsub(/#<Module.*>/, 'FragmentGraphQl__Dynamic')
|
37
|
-
end
|
38
|
-
end
|
12
|
+
module GraphQL
|
13
|
+
module StaticValidation
|
14
|
+
class LiteralValidator
|
15
|
+
alias recursive_validate_old recursively_validate
|
16
|
+
def recursively_validate(ast_value, type)
|
17
|
+
res = catch(:invalid) do
|
18
|
+
recursive_validate_old(ast_value, type)
|
19
|
+
end
|
20
|
+
if !res.valid? && type.kind.scalar? && ast_value.is_a?(GraphQL::Language::Nodes::InputObject)
|
21
|
+
maybe_raise_if_invalid(ast_value) do
|
22
|
+
['JSON', 'JSONObject', 'Any'].include?(type.graphql_name) ? @valid_response : @invalid_response
|
23
|
+
end
|
24
|
+
else
|
25
|
+
res
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
39
29
|
end
|
40
30
|
end
|
41
31
|
|
@@ -57,7 +47,22 @@ module FragmentGraphQl
|
|
57
47
|
|
58
48
|
FragmentSchema = T.let(GraphQL::Client.load_schema("#{__dir__}/fragment.schema.json"), T.untyped)
|
59
49
|
|
60
|
-
|
50
|
+
# Create a custom client class for Fragment-specific behavior
|
51
|
+
class CustomClient < GraphQL::Client
|
52
|
+
class Definition < GraphQL::Client::Definition
|
53
|
+
def definition_name
|
54
|
+
super.gsub(/#<Module.*>/, 'FragmentGraphQl__Dynamic')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Add this method to allow creating new instances
|
59
|
+
def self.new(schema:, execute:)
|
60
|
+
super(schema: schema, execute: execute)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Use our custom client instead of the base GraphQL::Client
|
65
|
+
Client = T.let(CustomClient.new(schema: FragmentSchema, execute: HTTP), CustomClient)
|
61
66
|
|
62
67
|
FragmentQueries = T.let(Client.parse(
|
63
68
|
File.read("#{__dir__}/queries.graphql")
|
@@ -89,7 +94,13 @@ class FragmentClient
|
|
89
94
|
execute = api_url ? FragmentGraphQl::CustomHTTP.new(URI.parse(api_url).to_s) : FragmentGraphQl::HTTP
|
90
95
|
@execute = T.let(execute, GraphQL::Client::HTTP)
|
91
96
|
|
92
|
-
@client = T.let(
|
97
|
+
@client = T.let(
|
98
|
+
FragmentGraphQl::CustomClient.new(
|
99
|
+
schema: FragmentGraphQl::FragmentSchema,
|
100
|
+
execute: @execute
|
101
|
+
),
|
102
|
+
FragmentGraphQl::CustomClient
|
103
|
+
)
|
93
104
|
@token = T.let(create_token, Token)
|
94
105
|
|
95
106
|
define_method_from_queries(FragmentGraphQl::FragmentQueries)
|
@@ -103,10 +114,15 @@ class FragmentClient
|
|
103
114
|
end
|
104
115
|
end
|
105
116
|
|
117
|
+
# Move these error class definitions up, before the query method
|
118
|
+
class ResponseError < GraphQL::Client::Error; end
|
119
|
+
class NetworkError < GraphQL::Client::Error; end
|
120
|
+
class AuthenticationError < StandardError; end
|
121
|
+
class TokenExpiredError < StandardError; end
|
122
|
+
|
106
123
|
sig { params(query: T.untyped, variables: T.untyped).returns(T.untyped) }
|
107
124
|
def query(query, variables)
|
108
|
-
|
109
|
-
@token = create_token if Time.now > @token.expires_at - expiry_time_skew
|
125
|
+
refresh_token_if_needed
|
110
126
|
@client.query(query, variables: variables, context: { access_token: @token.token })
|
111
127
|
end
|
112
128
|
|
@@ -138,17 +154,65 @@ class FragmentClient
|
|
138
154
|
|
139
155
|
case response
|
140
156
|
when Net::HTTPSuccess
|
141
|
-
# Parse the response body
|
142
157
|
body = JSON.parse(response.body)
|
143
158
|
Token.new(
|
144
159
|
token: T.let(body['access_token'], String),
|
145
160
|
expires_at: Time.now + T.let(body['expires_in'], Integer)
|
146
161
|
)
|
162
|
+
when Net::HTTPUnauthorized
|
163
|
+
raise AuthenticationError, "Invalid credentials: #{response.body}"
|
147
164
|
else
|
148
|
-
raise
|
165
|
+
raise AuthenticationError, "Authentication failed (#{response.code}): #{response.body}"
|
149
166
|
end
|
167
|
+
rescue JSON::ParserError => e
|
168
|
+
raise AuthenticationError, "Invalid response format: #{e.message}"
|
150
169
|
rescue StandardError => e
|
151
|
-
raise
|
170
|
+
raise AuthenticationError, "Authentication failed: #{e.message}"
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
class Configuration
|
175
|
+
extend T::Sig
|
176
|
+
|
177
|
+
sig { returns(Integer) }
|
178
|
+
attr_accessor :token_expiry_buffer
|
179
|
+
sig { returns(Logger) }
|
180
|
+
attr_accessor :logger
|
181
|
+
|
182
|
+
sig { void }
|
183
|
+
def initialize
|
184
|
+
@token_expiry_buffer = T.let(120, Integer)
|
185
|
+
@logger = T.let(Logger.new($stdout), Logger)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
class << self
|
190
|
+
extend T::Sig
|
191
|
+
|
192
|
+
sig { returns(Configuration) }
|
193
|
+
def configuration
|
194
|
+
@configuration ||= Configuration.new
|
152
195
|
end
|
196
|
+
|
197
|
+
sig { params(blk: T.proc.params(config: Configuration).void).void }
|
198
|
+
def configure(&blk)
|
199
|
+
yield(configuration)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
sig { returns(Logger) }
|
204
|
+
def logger
|
205
|
+
self.class.configuration.logger
|
206
|
+
end
|
207
|
+
|
208
|
+
sig { void }
|
209
|
+
def refresh_token_if_needed
|
210
|
+
return unless token_expired?
|
211
|
+
@token = create_token
|
212
|
+
end
|
213
|
+
|
214
|
+
sig { returns(T::Boolean) }
|
215
|
+
def token_expired?
|
216
|
+
Time.now > @token.expires_at - self.class.configuration.token_expiry_buffer
|
153
217
|
end
|
154
218
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fragment-dev
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fragment
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
|
-
rubygems_version: 3.5.
|
91
|
+
rubygems_version: 3.5.9
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: the ruby fragment client sdk
|