@dvina/sdk 4.1.59 → 4.1.66
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/_generated_documents-VM6RSSXR.js +1 -0
- package/dist/adapters/angular/index.d.ts +2 -2
- package/dist/adapters/angular/index.js +1 -159
- package/dist/adapters/react/index.js +1 -49
- package/dist/billing/index.js +1 -5
- package/dist/chunk-5E7LX4YQ.js +1 -0
- package/dist/chunk-D2L26FRK.js +5 -0
- package/dist/chunk-EK7ODJWE.js +1 -0
- package/dist/chunk-G34ETQUN.js +1 -0
- package/dist/chunk-H3TI6B7T.js +1 -0
- package/dist/chunk-IIQ3WGOJ.js +1 -0
- package/dist/chunk-IO56LXKJ.js +1 -0
- package/dist/chunk-SJ6Q5IDB.js +31 -0
- package/dist/{client-D309vpHA.d.ts → client-CEoJfTM9.d.ts} +2 -257
- package/dist/{index-fFR5so7x.d.ts → index-BzmzBgTh.d.ts} +1 -1
- package/dist/index.d.ts +7 -134
- package/dist/index.js +1 -10
- package/dist/inference/index.js +1 -5
- package/dist/package.json +12 -48
- package/dist/pagination/index.d.ts +2 -2
- package/dist/pagination/index.js +1 -5
- package/dist/{sync-engine-BIaOIpU3.d.ts → sync-engine-Bh0UcTVd.d.ts} +13 -0
- package/package.json +13 -49
- package/dist/_generated_documents-GHGFCEAV.js +0 -4
- package/dist/_generated_documents-GHGFCEAV.js.map +0 -1
- package/dist/_generated_documents-Z5MUI5BE.cjs +0 -2777
- package/dist/_generated_documents-Z5MUI5BE.cjs.map +0 -1
- package/dist/adapters/angular/index.cjs +0 -163
- package/dist/adapters/angular/index.cjs.map +0 -1
- package/dist/adapters/angular/index.d.cts +0 -254
- package/dist/adapters/angular/index.js.map +0 -1
- package/dist/adapters/react/index.cjs +0 -51
- package/dist/adapters/react/index.cjs.map +0 -1
- package/dist/adapters/react/index.d.cts +0 -62
- package/dist/adapters/react/index.js.map +0 -1
- package/dist/billing/index.cjs +0 -26
- package/dist/billing/index.cjs.map +0 -1
- package/dist/billing/index.d.cts +0 -328
- package/dist/billing/index.js.map +0 -1
- package/dist/chunk-2J5WONKO.cjs +0 -1608
- package/dist/chunk-2J5WONKO.cjs.map +0 -1
- package/dist/chunk-342BFYZZ.cjs +0 -98
- package/dist/chunk-342BFYZZ.cjs.map +0 -1
- package/dist/chunk-5WRI5ZAA.js +0 -29
- package/dist/chunk-5WRI5ZAA.js.map +0 -1
- package/dist/chunk-7XBJ77RJ.js +0 -103
- package/dist/chunk-7XBJ77RJ.js.map +0 -1
- package/dist/chunk-AE5KAIKK.js +0 -24
- package/dist/chunk-AE5KAIKK.js.map +0 -1
- package/dist/chunk-COFT5ZYL.js +0 -23777
- package/dist/chunk-COFT5ZYL.js.map +0 -1
- package/dist/chunk-DZUJEN5N.cjs +0 -32
- package/dist/chunk-DZUJEN5N.cjs.map +0 -1
- package/dist/chunk-FOKGSMXS.cjs +0 -27
- package/dist/chunk-FOKGSMXS.cjs.map +0 -1
- package/dist/chunk-HHBDJ65K.cjs +0 -24198
- package/dist/chunk-HHBDJ65K.cjs.map +0 -1
- package/dist/chunk-KEM6SUTS.js +0 -92
- package/dist/chunk-KEM6SUTS.js.map +0 -1
- package/dist/chunk-KSVHC4YE.cjs +0 -1841
- package/dist/chunk-KSVHC4YE.cjs.map +0 -1
- package/dist/chunk-KV5SP7RP.cjs +0 -114
- package/dist/chunk-KV5SP7RP.cjs.map +0 -1
- package/dist/chunk-NH4SMZCW.js +0 -1148
- package/dist/chunk-NH4SMZCW.js.map +0 -1
- package/dist/chunk-PDM2KR7T.js +0 -392
- package/dist/chunk-PDM2KR7T.js.map +0 -1
- package/dist/chunk-UELAE75E.cjs +0 -408
- package/dist/chunk-UELAE75E.cjs.map +0 -1
- package/dist/chunk-WX7EFPHT.js +0 -1600
- package/dist/chunk-WX7EFPHT.js.map +0 -1
- package/dist/client-BRIS6DdR.d.cts +0 -8159
- package/dist/client-Bb2gD6Iz.d.cts +0 -488
- package/dist/error-CsVoUTY8.d.cts +0 -95
- package/dist/index-D_Z25Pa1.d.cts +0 -79
- package/dist/index.cjs +0 -2039
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -3823
- package/dist/index.js.map +0 -1
- package/dist/inference/index.cjs +0 -70
- package/dist/inference/index.cjs.map +0 -1
- package/dist/inference/index.d.cts +0 -80
- package/dist/inference/index.js.map +0 -1
- package/dist/pagination/index.cjs +0 -34
- package/dist/pagination/index.cjs.map +0 -1
- package/dist/pagination/index.d.cts +0 -6
- package/dist/pagination/index.js.map +0 -1
- package/dist/sync-engine-gpxyhQBl.d.cts +0 -478
- package/dist/types-Chg8ASmf.d.cts +0 -116
package/dist/chunk-WX7EFPHT.js
DELETED
|
@@ -1,1600 +0,0 @@
|
|
|
1
|
-
import { GRAPHQL_ERROR_CODES, DvinaAuthenticationError, DvinaNetworkError, DvinaError, createGraphQLError } from './chunk-7XBJ77RJ.js';
|
|
2
|
-
|
|
3
|
-
// src/billing/_generated.ts
|
|
4
|
-
var EntitlementTier = /* @__PURE__ */ ((EntitlementTier2) => {
|
|
5
|
-
EntitlementTier2["Enterprise"] = "enterprise";
|
|
6
|
-
EntitlementTier2["Free"] = "free";
|
|
7
|
-
EntitlementTier2["Max"] = "max";
|
|
8
|
-
EntitlementTier2["Plus"] = "plus";
|
|
9
|
-
EntitlementTier2["Pro"] = "pro";
|
|
10
|
-
return EntitlementTier2;
|
|
11
|
-
})(EntitlementTier || {});
|
|
12
|
-
var SubscriptionCycle = /* @__PURE__ */ ((SubscriptionCycle2) => {
|
|
13
|
-
SubscriptionCycle2["Daily"] = "DAILY";
|
|
14
|
-
SubscriptionCycle2["Monthly"] = "MONTHLY";
|
|
15
|
-
SubscriptionCycle2["Weekly"] = "WEEKLY";
|
|
16
|
-
SubscriptionCycle2["Yearly"] = "YEARLY";
|
|
17
|
-
return SubscriptionCycle2;
|
|
18
|
-
})(SubscriptionCycle || {});
|
|
19
|
-
var SubscriptionProvider = /* @__PURE__ */ ((SubscriptionProvider2) => {
|
|
20
|
-
SubscriptionProvider2["Revcat"] = "REVCAT";
|
|
21
|
-
SubscriptionProvider2["Stripe"] = "STRIPE";
|
|
22
|
-
return SubscriptionProvider2;
|
|
23
|
-
})(SubscriptionProvider || {});
|
|
24
|
-
var PlansDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "Plans" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "plans" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "FragmentSpread", "name": { "kind": "Name", "value": "PlanFragment" } }] } }] } }, { "kind": "FragmentDefinition", "name": { "kind": "Name", "value": "PlanFragment" }, "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "Plan" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "tier" } }, { "kind": "Field", "name": { "kind": "Name", "value": "prices" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "currency" } }, { "kind": "Field", "name": { "kind": "Name", "value": "amount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "interval" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "entitlements" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "canAddUser" } }, { "kind": "Field", "name": { "kind": "Name", "value": "minUsers" } }, { "kind": "Field", "name": { "kind": "Name", "value": "team" } }, { "kind": "Field", "name": { "kind": "Name", "value": "capacity" } }, { "kind": "Field", "name": { "kind": "Name", "value": "sourceTypes" } }, { "kind": "Field", "name": { "kind": "Name", "value": "softTokenUsageLimit" } }, { "kind": "Field", "name": { "kind": "Name", "value": "hardTokenUsageLimit" } }, { "kind": "Field", "name": { "kind": "Name", "value": "canAddReport" } }, { "kind": "Field", "name": { "kind": "Name", "value": "canUseApi" } }, { "kind": "Field", "name": { "kind": "Name", "value": "maxStructuredSize" } }, { "kind": "Field", "name": { "kind": "Name", "value": "maxUnstructuredSize" } }, { "kind": "Field", "name": { "kind": "Name", "value": "deepAnalysisTokenLimit" } }, { "kind": "Field", "name": { "kind": "Name", "value": "deepAnalysisCharacterLimit" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "features" } }] } }] };
|
|
25
|
-
var PlanDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "Plan" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "plan" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "FragmentSpread", "name": { "kind": "Name", "value": "PlanFragment" } }] } }] } }, { "kind": "FragmentDefinition", "name": { "kind": "Name", "value": "PlanFragment" }, "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "Plan" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "tier" } }, { "kind": "Field", "name": { "kind": "Name", "value": "prices" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "currency" } }, { "kind": "Field", "name": { "kind": "Name", "value": "amount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "interval" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "entitlements" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "canAddUser" } }, { "kind": "Field", "name": { "kind": "Name", "value": "minUsers" } }, { "kind": "Field", "name": { "kind": "Name", "value": "team" } }, { "kind": "Field", "name": { "kind": "Name", "value": "capacity" } }, { "kind": "Field", "name": { "kind": "Name", "value": "sourceTypes" } }, { "kind": "Field", "name": { "kind": "Name", "value": "softTokenUsageLimit" } }, { "kind": "Field", "name": { "kind": "Name", "value": "hardTokenUsageLimit" } }, { "kind": "Field", "name": { "kind": "Name", "value": "canAddReport" } }, { "kind": "Field", "name": { "kind": "Name", "value": "canUseApi" } }, { "kind": "Field", "name": { "kind": "Name", "value": "maxStructuredSize" } }, { "kind": "Field", "name": { "kind": "Name", "value": "maxUnstructuredSize" } }, { "kind": "Field", "name": { "kind": "Name", "value": "deepAnalysisTokenLimit" } }, { "kind": "Field", "name": { "kind": "Name", "value": "deepAnalysisCharacterLimit" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "features" } }] } }] };
|
|
26
|
-
var TierOrdersDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "TierOrders" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "tierOrders" } }] } }] };
|
|
27
|
-
var EntitlementsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "Entitlements" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "entitlements" } }] } }] };
|
|
28
|
-
var SubscriptionDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "Subscription" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "subscription" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "tier" } }, { "kind": "Field", "name": { "kind": "Name", "value": "provider" } }, { "kind": "Field", "name": { "kind": "Name", "value": "cycle" } }, { "kind": "Field", "name": { "kind": "Name", "value": "seats" } }, { "kind": "Field", "name": { "kind": "Name", "value": "cancelAtPeriodEnd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "currentPeriodStart" } }, { "kind": "Field", "name": { "kind": "Name", "value": "currentPeriodEnd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "scheduledChange" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "effectiveDate" } }, { "kind": "Field", "name": { "kind": "Name", "value": "newTier" } }, { "kind": "Field", "name": { "kind": "Name", "value": "newSeats" } }, { "kind": "Field", "name": { "kind": "Name", "value": "newCycle" } }] } }] } }] } }] };
|
|
29
|
-
var SubscriptionForManagerDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "SubscriptionForManager" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "workspaceId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "subscriptionForManager" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "workspaceId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "workspaceId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "tier" } }, { "kind": "Field", "name": { "kind": "Name", "value": "provider" } }, { "kind": "Field", "name": { "kind": "Name", "value": "cycle" } }, { "kind": "Field", "name": { "kind": "Name", "value": "seats" } }, { "kind": "Field", "name": { "kind": "Name", "value": "cancelAtPeriodEnd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "currentPeriodStart" } }, { "kind": "Field", "name": { "kind": "Name", "value": "currentPeriodEnd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "scheduledChange" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "effectiveDate" } }, { "kind": "Field", "name": { "kind": "Name", "value": "newTier" } }, { "kind": "Field", "name": { "kind": "Name", "value": "newSeats" } }, { "kind": "Field", "name": { "kind": "Name", "value": "newCycle" } }] } }] } }] } }] };
|
|
30
|
-
var SubscriptionEntitlementsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "SubscriptionEntitlements" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "subscriptionEntitlements" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "canAddUser" } }, { "kind": "Field", "name": { "kind": "Name", "value": "minUsers" } }, { "kind": "Field", "name": { "kind": "Name", "value": "team" } }, { "kind": "Field", "name": { "kind": "Name", "value": "capacity" } }, { "kind": "Field", "name": { "kind": "Name", "value": "sourceTypes" } }, { "kind": "Field", "name": { "kind": "Name", "value": "softTokenUsageLimit" } }, { "kind": "Field", "name": { "kind": "Name", "value": "hardTokenUsageLimit" } }, { "kind": "Field", "name": { "kind": "Name", "value": "canAddReport" } }, { "kind": "Field", "name": { "kind": "Name", "value": "canUseApi" } }, { "kind": "Field", "name": { "kind": "Name", "value": "maxStructuredSize" } }, { "kind": "Field", "name": { "kind": "Name", "value": "maxUnstructuredSize" } }, { "kind": "Field", "name": { "kind": "Name", "value": "deepAnalysisTokenLimit" } }, { "kind": "Field", "name": { "kind": "Name", "value": "deepAnalysisCharacterLimit" } }] } }] } }] };
|
|
31
|
-
var SubscriptionEntitlementsForManagerDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "SubscriptionEntitlementsForManager" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "workspaceId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "subscriptionEntitlementsForManager" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "workspaceId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "workspaceId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "canAddUser" } }, { "kind": "Field", "name": { "kind": "Name", "value": "minUsers" } }, { "kind": "Field", "name": { "kind": "Name", "value": "team" } }, { "kind": "Field", "name": { "kind": "Name", "value": "capacity" } }, { "kind": "Field", "name": { "kind": "Name", "value": "sourceTypes" } }, { "kind": "Field", "name": { "kind": "Name", "value": "softTokenUsageLimit" } }, { "kind": "Field", "name": { "kind": "Name", "value": "hardTokenUsageLimit" } }, { "kind": "Field", "name": { "kind": "Name", "value": "canAddReport" } }, { "kind": "Field", "name": { "kind": "Name", "value": "canUseApi" } }, { "kind": "Field", "name": { "kind": "Name", "value": "maxStructuredSize" } }, { "kind": "Field", "name": { "kind": "Name", "value": "maxUnstructuredSize" } }, { "kind": "Field", "name": { "kind": "Name", "value": "deepAnalysisTokenLimit" } }, { "kind": "Field", "name": { "kind": "Name", "value": "deepAnalysisCharacterLimit" } }] } }] } }] };
|
|
32
|
-
var ProrationAmountDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "ProrationAmount" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "targetPriceId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "prorationAmount" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "targetPriceId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "targetPriceId" } } }] }] } }] };
|
|
33
|
-
var UpgradePlanDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "UpgradePlan" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "targetPriceId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "upgradePlan" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "targetPriceId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "targetPriceId" } } }] }] } }] };
|
|
34
|
-
var DowngradePlanDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "DowngradePlan" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "targetPriceId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "downgradePlan" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "targetPriceId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "targetPriceId" } } }] }] } }] };
|
|
35
|
-
var AddSeatsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "AddSeats" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "additionalSeats" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "addSeats" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "additionalSeats" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "additionalSeats" } } }] }] } }] };
|
|
36
|
-
var ChangeBillingCycleDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "ChangeBillingCycle" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "targetPriceId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "changeBillingCycle" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "targetPriceId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "targetPriceId" } } }] }] } }] };
|
|
37
|
-
var RemoveSeatsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "RemoveSeats" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "seatsToRemove" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "removeSeats" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "seatsToRemove" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "seatsToRemove" } } }] }] } }] };
|
|
38
|
-
var CancelSubscriptionDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CancelSubscription" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "cancelSubscription" } }] } }] };
|
|
39
|
-
var ReactivateSubscriptionDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "ReactivateSubscription" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "reactivateSubscription" } }] } }] };
|
|
40
|
-
var CancelSubscriptionForManagerDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CancelSubscriptionForManager" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "workspaceId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "cancelSubscriptionForManager" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "workspaceId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "workspaceId" } } }] }] } }] };
|
|
41
|
-
var ReactivateSubscriptionForManagerDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "ReactivateSubscriptionForManager" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "workspaceId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "reactivateSubscriptionForManager" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "workspaceId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "workspaceId" } } }] }] } }] };
|
|
42
|
-
var CreateCustomerDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CreateCustomer" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "name" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "email" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "workspaceId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "userId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "createCustomer" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "name" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "name" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "email" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "email" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "workspaceId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "workspaceId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "userId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "userId" } } }] }] } }] };
|
|
43
|
-
var ReleaseScheduleDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "ReleaseSchedule" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "releaseSchedule" } }] } }] };
|
|
44
|
-
var CreateCheckoutSessionDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CreateCheckoutSession" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "priceId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "successUrl" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "cancelUrl" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "createCheckoutSession" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "priceId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "priceId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "successUrl" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "successUrl" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "cancelUrl" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "cancelUrl" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "url" } }] } }] } }] };
|
|
45
|
-
var CreateCustomerPortalSessionDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CreateCustomerPortalSession" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "returnUrl" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "createCustomerPortalSession" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "returnUrl" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "returnUrl" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "url" } }] } }] } }] };
|
|
46
|
-
|
|
47
|
-
// ../../node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/jsutils/devAssert.mjs
|
|
48
|
-
function devAssert(condition, message) {
|
|
49
|
-
const booleanCondition = Boolean(condition);
|
|
50
|
-
if (!booleanCondition) {
|
|
51
|
-
throw new Error(message);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// ../../node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/language/ast.mjs
|
|
56
|
-
var QueryDocumentKeys = {
|
|
57
|
-
Name: [],
|
|
58
|
-
Document: ["definitions"],
|
|
59
|
-
OperationDefinition: [
|
|
60
|
-
"name",
|
|
61
|
-
"variableDefinitions",
|
|
62
|
-
"directives",
|
|
63
|
-
"selectionSet"
|
|
64
|
-
],
|
|
65
|
-
VariableDefinition: ["variable", "type", "defaultValue", "directives"],
|
|
66
|
-
Variable: ["name"],
|
|
67
|
-
SelectionSet: ["selections"],
|
|
68
|
-
Field: ["alias", "name", "arguments", "directives", "selectionSet"],
|
|
69
|
-
Argument: ["name", "value"],
|
|
70
|
-
FragmentSpread: ["name", "directives"],
|
|
71
|
-
InlineFragment: ["typeCondition", "directives", "selectionSet"],
|
|
72
|
-
FragmentDefinition: [
|
|
73
|
-
"name",
|
|
74
|
-
// Note: fragment variable definitions are deprecated and will removed in v17.0.0
|
|
75
|
-
"variableDefinitions",
|
|
76
|
-
"typeCondition",
|
|
77
|
-
"directives",
|
|
78
|
-
"selectionSet"
|
|
79
|
-
],
|
|
80
|
-
IntValue: [],
|
|
81
|
-
FloatValue: [],
|
|
82
|
-
StringValue: [],
|
|
83
|
-
BooleanValue: [],
|
|
84
|
-
NullValue: [],
|
|
85
|
-
EnumValue: [],
|
|
86
|
-
ListValue: ["values"],
|
|
87
|
-
ObjectValue: ["fields"],
|
|
88
|
-
ObjectField: ["name", "value"],
|
|
89
|
-
Directive: ["name", "arguments"],
|
|
90
|
-
NamedType: ["name"],
|
|
91
|
-
ListType: ["type"],
|
|
92
|
-
NonNullType: ["type"],
|
|
93
|
-
SchemaDefinition: ["description", "directives", "operationTypes"],
|
|
94
|
-
OperationTypeDefinition: ["type"],
|
|
95
|
-
ScalarTypeDefinition: ["description", "name", "directives"],
|
|
96
|
-
ObjectTypeDefinition: [
|
|
97
|
-
"description",
|
|
98
|
-
"name",
|
|
99
|
-
"interfaces",
|
|
100
|
-
"directives",
|
|
101
|
-
"fields"
|
|
102
|
-
],
|
|
103
|
-
FieldDefinition: ["description", "name", "arguments", "type", "directives"],
|
|
104
|
-
InputValueDefinition: [
|
|
105
|
-
"description",
|
|
106
|
-
"name",
|
|
107
|
-
"type",
|
|
108
|
-
"defaultValue",
|
|
109
|
-
"directives"
|
|
110
|
-
],
|
|
111
|
-
InterfaceTypeDefinition: [
|
|
112
|
-
"description",
|
|
113
|
-
"name",
|
|
114
|
-
"interfaces",
|
|
115
|
-
"directives",
|
|
116
|
-
"fields"
|
|
117
|
-
],
|
|
118
|
-
UnionTypeDefinition: ["description", "name", "directives", "types"],
|
|
119
|
-
EnumTypeDefinition: ["description", "name", "directives", "values"],
|
|
120
|
-
EnumValueDefinition: ["description", "name", "directives"],
|
|
121
|
-
InputObjectTypeDefinition: ["description", "name", "directives", "fields"],
|
|
122
|
-
DirectiveDefinition: ["description", "name", "arguments", "locations"],
|
|
123
|
-
SchemaExtension: ["directives", "operationTypes"],
|
|
124
|
-
ScalarTypeExtension: ["name", "directives"],
|
|
125
|
-
ObjectTypeExtension: ["name", "interfaces", "directives", "fields"],
|
|
126
|
-
InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"],
|
|
127
|
-
UnionTypeExtension: ["name", "directives", "types"],
|
|
128
|
-
EnumTypeExtension: ["name", "directives", "values"],
|
|
129
|
-
InputObjectTypeExtension: ["name", "directives", "fields"]
|
|
130
|
-
};
|
|
131
|
-
var kindValues = new Set(Object.keys(QueryDocumentKeys));
|
|
132
|
-
function isNode(maybeNode) {
|
|
133
|
-
const maybeKind = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind;
|
|
134
|
-
return typeof maybeKind === "string" && kindValues.has(maybeKind);
|
|
135
|
-
}
|
|
136
|
-
var OperationTypeNode;
|
|
137
|
-
(function(OperationTypeNode2) {
|
|
138
|
-
OperationTypeNode2["QUERY"] = "query";
|
|
139
|
-
OperationTypeNode2["MUTATION"] = "mutation";
|
|
140
|
-
OperationTypeNode2["SUBSCRIPTION"] = "subscription";
|
|
141
|
-
})(OperationTypeNode || (OperationTypeNode = {}));
|
|
142
|
-
|
|
143
|
-
// ../../node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/language/kinds.mjs
|
|
144
|
-
var Kind;
|
|
145
|
-
(function(Kind2) {
|
|
146
|
-
Kind2["NAME"] = "Name";
|
|
147
|
-
Kind2["DOCUMENT"] = "Document";
|
|
148
|
-
Kind2["OPERATION_DEFINITION"] = "OperationDefinition";
|
|
149
|
-
Kind2["VARIABLE_DEFINITION"] = "VariableDefinition";
|
|
150
|
-
Kind2["SELECTION_SET"] = "SelectionSet";
|
|
151
|
-
Kind2["FIELD"] = "Field";
|
|
152
|
-
Kind2["ARGUMENT"] = "Argument";
|
|
153
|
-
Kind2["FRAGMENT_SPREAD"] = "FragmentSpread";
|
|
154
|
-
Kind2["INLINE_FRAGMENT"] = "InlineFragment";
|
|
155
|
-
Kind2["FRAGMENT_DEFINITION"] = "FragmentDefinition";
|
|
156
|
-
Kind2["VARIABLE"] = "Variable";
|
|
157
|
-
Kind2["INT"] = "IntValue";
|
|
158
|
-
Kind2["FLOAT"] = "FloatValue";
|
|
159
|
-
Kind2["STRING"] = "StringValue";
|
|
160
|
-
Kind2["BOOLEAN"] = "BooleanValue";
|
|
161
|
-
Kind2["NULL"] = "NullValue";
|
|
162
|
-
Kind2["ENUM"] = "EnumValue";
|
|
163
|
-
Kind2["LIST"] = "ListValue";
|
|
164
|
-
Kind2["OBJECT"] = "ObjectValue";
|
|
165
|
-
Kind2["OBJECT_FIELD"] = "ObjectField";
|
|
166
|
-
Kind2["DIRECTIVE"] = "Directive";
|
|
167
|
-
Kind2["NAMED_TYPE"] = "NamedType";
|
|
168
|
-
Kind2["LIST_TYPE"] = "ListType";
|
|
169
|
-
Kind2["NON_NULL_TYPE"] = "NonNullType";
|
|
170
|
-
Kind2["SCHEMA_DEFINITION"] = "SchemaDefinition";
|
|
171
|
-
Kind2["OPERATION_TYPE_DEFINITION"] = "OperationTypeDefinition";
|
|
172
|
-
Kind2["SCALAR_TYPE_DEFINITION"] = "ScalarTypeDefinition";
|
|
173
|
-
Kind2["OBJECT_TYPE_DEFINITION"] = "ObjectTypeDefinition";
|
|
174
|
-
Kind2["FIELD_DEFINITION"] = "FieldDefinition";
|
|
175
|
-
Kind2["INPUT_VALUE_DEFINITION"] = "InputValueDefinition";
|
|
176
|
-
Kind2["INTERFACE_TYPE_DEFINITION"] = "InterfaceTypeDefinition";
|
|
177
|
-
Kind2["UNION_TYPE_DEFINITION"] = "UnionTypeDefinition";
|
|
178
|
-
Kind2["ENUM_TYPE_DEFINITION"] = "EnumTypeDefinition";
|
|
179
|
-
Kind2["ENUM_VALUE_DEFINITION"] = "EnumValueDefinition";
|
|
180
|
-
Kind2["INPUT_OBJECT_TYPE_DEFINITION"] = "InputObjectTypeDefinition";
|
|
181
|
-
Kind2["DIRECTIVE_DEFINITION"] = "DirectiveDefinition";
|
|
182
|
-
Kind2["SCHEMA_EXTENSION"] = "SchemaExtension";
|
|
183
|
-
Kind2["SCALAR_TYPE_EXTENSION"] = "ScalarTypeExtension";
|
|
184
|
-
Kind2["OBJECT_TYPE_EXTENSION"] = "ObjectTypeExtension";
|
|
185
|
-
Kind2["INTERFACE_TYPE_EXTENSION"] = "InterfaceTypeExtension";
|
|
186
|
-
Kind2["UNION_TYPE_EXTENSION"] = "UnionTypeExtension";
|
|
187
|
-
Kind2["ENUM_TYPE_EXTENSION"] = "EnumTypeExtension";
|
|
188
|
-
Kind2["INPUT_OBJECT_TYPE_EXTENSION"] = "InputObjectTypeExtension";
|
|
189
|
-
})(Kind || (Kind = {}));
|
|
190
|
-
|
|
191
|
-
// ../../node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/language/characterClasses.mjs
|
|
192
|
-
function isWhiteSpace(code) {
|
|
193
|
-
return code === 9 || code === 32;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// ../../node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/language/blockString.mjs
|
|
197
|
-
function printBlockString(value, options) {
|
|
198
|
-
const escapedValue = value.replace(/"""/g, '\\"""');
|
|
199
|
-
const lines = escapedValue.split(/\r\n|[\n\r]/g);
|
|
200
|
-
const isSingleLine = lines.length === 1;
|
|
201
|
-
const forceLeadingNewLine = lines.length > 1 && lines.slice(1).every((line) => line.length === 0 || isWhiteSpace(line.charCodeAt(0)));
|
|
202
|
-
const hasTrailingTripleQuotes = escapedValue.endsWith('\\"""');
|
|
203
|
-
const hasTrailingQuote = value.endsWith('"') && !hasTrailingTripleQuotes;
|
|
204
|
-
const hasTrailingSlash = value.endsWith("\\");
|
|
205
|
-
const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash;
|
|
206
|
-
const printAsMultipleLines = // add leading and trailing new lines only if it improves readability
|
|
207
|
-
(!isSingleLine || value.length > 70 || forceTrailingNewline || forceLeadingNewLine || hasTrailingTripleQuotes);
|
|
208
|
-
let result = "";
|
|
209
|
-
const skipLeadingNewLine = isSingleLine && isWhiteSpace(value.charCodeAt(0));
|
|
210
|
-
if (printAsMultipleLines && !skipLeadingNewLine || forceLeadingNewLine) {
|
|
211
|
-
result += "\n";
|
|
212
|
-
}
|
|
213
|
-
result += escapedValue;
|
|
214
|
-
if (printAsMultipleLines || forceTrailingNewline) {
|
|
215
|
-
result += "\n";
|
|
216
|
-
}
|
|
217
|
-
return '"""' + result + '"""';
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// ../../node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/jsutils/inspect.mjs
|
|
221
|
-
var MAX_ARRAY_LENGTH = 10;
|
|
222
|
-
var MAX_RECURSIVE_DEPTH = 2;
|
|
223
|
-
function inspect(value) {
|
|
224
|
-
return formatValue(value, []);
|
|
225
|
-
}
|
|
226
|
-
function formatValue(value, seenValues) {
|
|
227
|
-
switch (typeof value) {
|
|
228
|
-
case "string":
|
|
229
|
-
return JSON.stringify(value);
|
|
230
|
-
case "function":
|
|
231
|
-
return value.name ? `[function ${value.name}]` : "[function]";
|
|
232
|
-
case "object":
|
|
233
|
-
return formatObjectValue(value, seenValues);
|
|
234
|
-
default:
|
|
235
|
-
return String(value);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
function formatObjectValue(value, previouslySeenValues) {
|
|
239
|
-
if (value === null) {
|
|
240
|
-
return "null";
|
|
241
|
-
}
|
|
242
|
-
if (previouslySeenValues.includes(value)) {
|
|
243
|
-
return "[Circular]";
|
|
244
|
-
}
|
|
245
|
-
const seenValues = [...previouslySeenValues, value];
|
|
246
|
-
if (isJSONable(value)) {
|
|
247
|
-
const jsonValue = value.toJSON();
|
|
248
|
-
if (jsonValue !== value) {
|
|
249
|
-
return typeof jsonValue === "string" ? jsonValue : formatValue(jsonValue, seenValues);
|
|
250
|
-
}
|
|
251
|
-
} else if (Array.isArray(value)) {
|
|
252
|
-
return formatArray(value, seenValues);
|
|
253
|
-
}
|
|
254
|
-
return formatObject(value, seenValues);
|
|
255
|
-
}
|
|
256
|
-
function isJSONable(value) {
|
|
257
|
-
return typeof value.toJSON === "function";
|
|
258
|
-
}
|
|
259
|
-
function formatObject(object, seenValues) {
|
|
260
|
-
const entries = Object.entries(object);
|
|
261
|
-
if (entries.length === 0) {
|
|
262
|
-
return "{}";
|
|
263
|
-
}
|
|
264
|
-
if (seenValues.length > MAX_RECURSIVE_DEPTH) {
|
|
265
|
-
return "[" + getObjectTag(object) + "]";
|
|
266
|
-
}
|
|
267
|
-
const properties = entries.map(
|
|
268
|
-
([key, value]) => key + ": " + formatValue(value, seenValues)
|
|
269
|
-
);
|
|
270
|
-
return "{ " + properties.join(", ") + " }";
|
|
271
|
-
}
|
|
272
|
-
function formatArray(array, seenValues) {
|
|
273
|
-
if (array.length === 0) {
|
|
274
|
-
return "[]";
|
|
275
|
-
}
|
|
276
|
-
if (seenValues.length > MAX_RECURSIVE_DEPTH) {
|
|
277
|
-
return "[Array]";
|
|
278
|
-
}
|
|
279
|
-
const len = Math.min(MAX_ARRAY_LENGTH, array.length);
|
|
280
|
-
const remaining = array.length - len;
|
|
281
|
-
const items = [];
|
|
282
|
-
for (let i = 0; i < len; ++i) {
|
|
283
|
-
items.push(formatValue(array[i], seenValues));
|
|
284
|
-
}
|
|
285
|
-
if (remaining === 1) {
|
|
286
|
-
items.push("... 1 more item");
|
|
287
|
-
} else if (remaining > 1) {
|
|
288
|
-
items.push(`... ${remaining} more items`);
|
|
289
|
-
}
|
|
290
|
-
return "[" + items.join(", ") + "]";
|
|
291
|
-
}
|
|
292
|
-
function getObjectTag(object) {
|
|
293
|
-
const tag = Object.prototype.toString.call(object).replace(/^\[object /, "").replace(/]$/, "");
|
|
294
|
-
if (tag === "Object" && typeof object.constructor === "function") {
|
|
295
|
-
const name = object.constructor.name;
|
|
296
|
-
if (typeof name === "string" && name !== "") {
|
|
297
|
-
return name;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
return tag;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
// ../../node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/language/printString.mjs
|
|
304
|
-
function printString(str) {
|
|
305
|
-
return `"${str.replace(escapedRegExp, escapedReplacer)}"`;
|
|
306
|
-
}
|
|
307
|
-
var escapedRegExp = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
|
|
308
|
-
function escapedReplacer(str) {
|
|
309
|
-
return escapeSequences[str.charCodeAt(0)];
|
|
310
|
-
}
|
|
311
|
-
var escapeSequences = [
|
|
312
|
-
"\\u0000",
|
|
313
|
-
"\\u0001",
|
|
314
|
-
"\\u0002",
|
|
315
|
-
"\\u0003",
|
|
316
|
-
"\\u0004",
|
|
317
|
-
"\\u0005",
|
|
318
|
-
"\\u0006",
|
|
319
|
-
"\\u0007",
|
|
320
|
-
"\\b",
|
|
321
|
-
"\\t",
|
|
322
|
-
"\\n",
|
|
323
|
-
"\\u000B",
|
|
324
|
-
"\\f",
|
|
325
|
-
"\\r",
|
|
326
|
-
"\\u000E",
|
|
327
|
-
"\\u000F",
|
|
328
|
-
"\\u0010",
|
|
329
|
-
"\\u0011",
|
|
330
|
-
"\\u0012",
|
|
331
|
-
"\\u0013",
|
|
332
|
-
"\\u0014",
|
|
333
|
-
"\\u0015",
|
|
334
|
-
"\\u0016",
|
|
335
|
-
"\\u0017",
|
|
336
|
-
"\\u0018",
|
|
337
|
-
"\\u0019",
|
|
338
|
-
"\\u001A",
|
|
339
|
-
"\\u001B",
|
|
340
|
-
"\\u001C",
|
|
341
|
-
"\\u001D",
|
|
342
|
-
"\\u001E",
|
|
343
|
-
"\\u001F",
|
|
344
|
-
"",
|
|
345
|
-
"",
|
|
346
|
-
'\\"',
|
|
347
|
-
"",
|
|
348
|
-
"",
|
|
349
|
-
"",
|
|
350
|
-
"",
|
|
351
|
-
"",
|
|
352
|
-
"",
|
|
353
|
-
"",
|
|
354
|
-
"",
|
|
355
|
-
"",
|
|
356
|
-
"",
|
|
357
|
-
"",
|
|
358
|
-
"",
|
|
359
|
-
"",
|
|
360
|
-
// 2F
|
|
361
|
-
"",
|
|
362
|
-
"",
|
|
363
|
-
"",
|
|
364
|
-
"",
|
|
365
|
-
"",
|
|
366
|
-
"",
|
|
367
|
-
"",
|
|
368
|
-
"",
|
|
369
|
-
"",
|
|
370
|
-
"",
|
|
371
|
-
"",
|
|
372
|
-
"",
|
|
373
|
-
"",
|
|
374
|
-
"",
|
|
375
|
-
"",
|
|
376
|
-
"",
|
|
377
|
-
// 3F
|
|
378
|
-
"",
|
|
379
|
-
"",
|
|
380
|
-
"",
|
|
381
|
-
"",
|
|
382
|
-
"",
|
|
383
|
-
"",
|
|
384
|
-
"",
|
|
385
|
-
"",
|
|
386
|
-
"",
|
|
387
|
-
"",
|
|
388
|
-
"",
|
|
389
|
-
"",
|
|
390
|
-
"",
|
|
391
|
-
"",
|
|
392
|
-
"",
|
|
393
|
-
"",
|
|
394
|
-
// 4F
|
|
395
|
-
"",
|
|
396
|
-
"",
|
|
397
|
-
"",
|
|
398
|
-
"",
|
|
399
|
-
"",
|
|
400
|
-
"",
|
|
401
|
-
"",
|
|
402
|
-
"",
|
|
403
|
-
"",
|
|
404
|
-
"",
|
|
405
|
-
"",
|
|
406
|
-
"",
|
|
407
|
-
"\\\\",
|
|
408
|
-
"",
|
|
409
|
-
"",
|
|
410
|
-
"",
|
|
411
|
-
// 5F
|
|
412
|
-
"",
|
|
413
|
-
"",
|
|
414
|
-
"",
|
|
415
|
-
"",
|
|
416
|
-
"",
|
|
417
|
-
"",
|
|
418
|
-
"",
|
|
419
|
-
"",
|
|
420
|
-
"",
|
|
421
|
-
"",
|
|
422
|
-
"",
|
|
423
|
-
"",
|
|
424
|
-
"",
|
|
425
|
-
"",
|
|
426
|
-
"",
|
|
427
|
-
"",
|
|
428
|
-
// 6F
|
|
429
|
-
"",
|
|
430
|
-
"",
|
|
431
|
-
"",
|
|
432
|
-
"",
|
|
433
|
-
"",
|
|
434
|
-
"",
|
|
435
|
-
"",
|
|
436
|
-
"",
|
|
437
|
-
"",
|
|
438
|
-
"",
|
|
439
|
-
"",
|
|
440
|
-
"",
|
|
441
|
-
"",
|
|
442
|
-
"",
|
|
443
|
-
"",
|
|
444
|
-
"\\u007F",
|
|
445
|
-
"\\u0080",
|
|
446
|
-
"\\u0081",
|
|
447
|
-
"\\u0082",
|
|
448
|
-
"\\u0083",
|
|
449
|
-
"\\u0084",
|
|
450
|
-
"\\u0085",
|
|
451
|
-
"\\u0086",
|
|
452
|
-
"\\u0087",
|
|
453
|
-
"\\u0088",
|
|
454
|
-
"\\u0089",
|
|
455
|
-
"\\u008A",
|
|
456
|
-
"\\u008B",
|
|
457
|
-
"\\u008C",
|
|
458
|
-
"\\u008D",
|
|
459
|
-
"\\u008E",
|
|
460
|
-
"\\u008F",
|
|
461
|
-
"\\u0090",
|
|
462
|
-
"\\u0091",
|
|
463
|
-
"\\u0092",
|
|
464
|
-
"\\u0093",
|
|
465
|
-
"\\u0094",
|
|
466
|
-
"\\u0095",
|
|
467
|
-
"\\u0096",
|
|
468
|
-
"\\u0097",
|
|
469
|
-
"\\u0098",
|
|
470
|
-
"\\u0099",
|
|
471
|
-
"\\u009A",
|
|
472
|
-
"\\u009B",
|
|
473
|
-
"\\u009C",
|
|
474
|
-
"\\u009D",
|
|
475
|
-
"\\u009E",
|
|
476
|
-
"\\u009F"
|
|
477
|
-
];
|
|
478
|
-
|
|
479
|
-
// ../../node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/language/visitor.mjs
|
|
480
|
-
var BREAK = Object.freeze({});
|
|
481
|
-
function visit(root, visitor, visitorKeys = QueryDocumentKeys) {
|
|
482
|
-
const enterLeaveMap = /* @__PURE__ */ new Map();
|
|
483
|
-
for (const kind of Object.values(Kind)) {
|
|
484
|
-
enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind));
|
|
485
|
-
}
|
|
486
|
-
let stack = void 0;
|
|
487
|
-
let inArray = Array.isArray(root);
|
|
488
|
-
let keys = [root];
|
|
489
|
-
let index = -1;
|
|
490
|
-
let edits = [];
|
|
491
|
-
let node = root;
|
|
492
|
-
let key = void 0;
|
|
493
|
-
let parent = void 0;
|
|
494
|
-
const path = [];
|
|
495
|
-
const ancestors = [];
|
|
496
|
-
do {
|
|
497
|
-
index++;
|
|
498
|
-
const isLeaving = index === keys.length;
|
|
499
|
-
const isEdited = isLeaving && edits.length !== 0;
|
|
500
|
-
if (isLeaving) {
|
|
501
|
-
key = ancestors.length === 0 ? void 0 : path[path.length - 1];
|
|
502
|
-
node = parent;
|
|
503
|
-
parent = ancestors.pop();
|
|
504
|
-
if (isEdited) {
|
|
505
|
-
if (inArray) {
|
|
506
|
-
node = node.slice();
|
|
507
|
-
let editOffset = 0;
|
|
508
|
-
for (const [editKey, editValue] of edits) {
|
|
509
|
-
const arrayKey = editKey - editOffset;
|
|
510
|
-
if (editValue === null) {
|
|
511
|
-
node.splice(arrayKey, 1);
|
|
512
|
-
editOffset++;
|
|
513
|
-
} else {
|
|
514
|
-
node[arrayKey] = editValue;
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
} else {
|
|
518
|
-
node = Object.defineProperties(
|
|
519
|
-
{},
|
|
520
|
-
Object.getOwnPropertyDescriptors(node)
|
|
521
|
-
);
|
|
522
|
-
for (const [editKey, editValue] of edits) {
|
|
523
|
-
node[editKey] = editValue;
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
index = stack.index;
|
|
528
|
-
keys = stack.keys;
|
|
529
|
-
edits = stack.edits;
|
|
530
|
-
inArray = stack.inArray;
|
|
531
|
-
stack = stack.prev;
|
|
532
|
-
} else if (parent) {
|
|
533
|
-
key = inArray ? index : keys[index];
|
|
534
|
-
node = parent[key];
|
|
535
|
-
if (node === null || node === void 0) {
|
|
536
|
-
continue;
|
|
537
|
-
}
|
|
538
|
-
path.push(key);
|
|
539
|
-
}
|
|
540
|
-
let result;
|
|
541
|
-
if (!Array.isArray(node)) {
|
|
542
|
-
var _enterLeaveMap$get, _enterLeaveMap$get2;
|
|
543
|
-
isNode(node) || devAssert(false, `Invalid AST Node: ${inspect(node)}.`);
|
|
544
|
-
const visitFn = isLeaving ? (_enterLeaveMap$get = enterLeaveMap.get(node.kind)) === null || _enterLeaveMap$get === void 0 ? void 0 : _enterLeaveMap$get.leave : (_enterLeaveMap$get2 = enterLeaveMap.get(node.kind)) === null || _enterLeaveMap$get2 === void 0 ? void 0 : _enterLeaveMap$get2.enter;
|
|
545
|
-
result = visitFn === null || visitFn === void 0 ? void 0 : visitFn.call(visitor, node, key, parent, path, ancestors);
|
|
546
|
-
if (result === BREAK) {
|
|
547
|
-
break;
|
|
548
|
-
}
|
|
549
|
-
if (result === false) {
|
|
550
|
-
if (!isLeaving) {
|
|
551
|
-
path.pop();
|
|
552
|
-
continue;
|
|
553
|
-
}
|
|
554
|
-
} else if (result !== void 0) {
|
|
555
|
-
edits.push([key, result]);
|
|
556
|
-
if (!isLeaving) {
|
|
557
|
-
if (isNode(result)) {
|
|
558
|
-
node = result;
|
|
559
|
-
} else {
|
|
560
|
-
path.pop();
|
|
561
|
-
continue;
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
if (result === void 0 && isEdited) {
|
|
567
|
-
edits.push([key, node]);
|
|
568
|
-
}
|
|
569
|
-
if (isLeaving) {
|
|
570
|
-
path.pop();
|
|
571
|
-
} else {
|
|
572
|
-
var _node$kind;
|
|
573
|
-
stack = {
|
|
574
|
-
inArray,
|
|
575
|
-
index,
|
|
576
|
-
keys,
|
|
577
|
-
edits,
|
|
578
|
-
prev: stack
|
|
579
|
-
};
|
|
580
|
-
inArray = Array.isArray(node);
|
|
581
|
-
keys = inArray ? node : (_node$kind = visitorKeys[node.kind]) !== null && _node$kind !== void 0 ? _node$kind : [];
|
|
582
|
-
index = -1;
|
|
583
|
-
edits = [];
|
|
584
|
-
if (parent) {
|
|
585
|
-
ancestors.push(parent);
|
|
586
|
-
}
|
|
587
|
-
parent = node;
|
|
588
|
-
}
|
|
589
|
-
} while (stack !== void 0);
|
|
590
|
-
if (edits.length !== 0) {
|
|
591
|
-
return edits[edits.length - 1][1];
|
|
592
|
-
}
|
|
593
|
-
return root;
|
|
594
|
-
}
|
|
595
|
-
function getEnterLeaveForKind(visitor, kind) {
|
|
596
|
-
const kindVisitor = visitor[kind];
|
|
597
|
-
if (typeof kindVisitor === "object") {
|
|
598
|
-
return kindVisitor;
|
|
599
|
-
} else if (typeof kindVisitor === "function") {
|
|
600
|
-
return {
|
|
601
|
-
enter: kindVisitor,
|
|
602
|
-
leave: void 0
|
|
603
|
-
};
|
|
604
|
-
}
|
|
605
|
-
return {
|
|
606
|
-
enter: visitor.enter,
|
|
607
|
-
leave: visitor.leave
|
|
608
|
-
};
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
// ../../node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/language/printer.mjs
|
|
612
|
-
function print(ast) {
|
|
613
|
-
return visit(ast, printDocASTReducer);
|
|
614
|
-
}
|
|
615
|
-
var MAX_LINE_LENGTH = 80;
|
|
616
|
-
var printDocASTReducer = {
|
|
617
|
-
Name: {
|
|
618
|
-
leave: (node) => node.value
|
|
619
|
-
},
|
|
620
|
-
Variable: {
|
|
621
|
-
leave: (node) => "$" + node.name
|
|
622
|
-
},
|
|
623
|
-
// Document
|
|
624
|
-
Document: {
|
|
625
|
-
leave: (node) => join(node.definitions, "\n\n")
|
|
626
|
-
},
|
|
627
|
-
OperationDefinition: {
|
|
628
|
-
leave(node) {
|
|
629
|
-
const varDefs = wrap("(", join(node.variableDefinitions, ", "), ")");
|
|
630
|
-
const prefix = join(
|
|
631
|
-
[
|
|
632
|
-
node.operation,
|
|
633
|
-
join([node.name, varDefs]),
|
|
634
|
-
join(node.directives, " ")
|
|
635
|
-
],
|
|
636
|
-
" "
|
|
637
|
-
);
|
|
638
|
-
return (prefix === "query" ? "" : prefix + " ") + node.selectionSet;
|
|
639
|
-
}
|
|
640
|
-
},
|
|
641
|
-
VariableDefinition: {
|
|
642
|
-
leave: ({ variable, type, defaultValue, directives }) => variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ", join(directives, " "))
|
|
643
|
-
},
|
|
644
|
-
SelectionSet: {
|
|
645
|
-
leave: ({ selections }) => block(selections)
|
|
646
|
-
},
|
|
647
|
-
Field: {
|
|
648
|
-
leave({ alias, name, arguments: args, directives, selectionSet }) {
|
|
649
|
-
const prefix = wrap("", alias, ": ") + name;
|
|
650
|
-
let argsLine = prefix + wrap("(", join(args, ", "), ")");
|
|
651
|
-
if (argsLine.length > MAX_LINE_LENGTH) {
|
|
652
|
-
argsLine = prefix + wrap("(\n", indent(join(args, "\n")), "\n)");
|
|
653
|
-
}
|
|
654
|
-
return join([argsLine, join(directives, " "), selectionSet], " ");
|
|
655
|
-
}
|
|
656
|
-
},
|
|
657
|
-
Argument: {
|
|
658
|
-
leave: ({ name, value }) => name + ": " + value
|
|
659
|
-
},
|
|
660
|
-
// Fragments
|
|
661
|
-
FragmentSpread: {
|
|
662
|
-
leave: ({ name, directives }) => "..." + name + wrap(" ", join(directives, " "))
|
|
663
|
-
},
|
|
664
|
-
InlineFragment: {
|
|
665
|
-
leave: ({ typeCondition, directives, selectionSet }) => join(
|
|
666
|
-
[
|
|
667
|
-
"...",
|
|
668
|
-
wrap("on ", typeCondition),
|
|
669
|
-
join(directives, " "),
|
|
670
|
-
selectionSet
|
|
671
|
-
],
|
|
672
|
-
" "
|
|
673
|
-
)
|
|
674
|
-
},
|
|
675
|
-
FragmentDefinition: {
|
|
676
|
-
leave: ({ name, typeCondition, variableDefinitions, directives, selectionSet }) => (
|
|
677
|
-
// or removed in the future.
|
|
678
|
-
`fragment ${name}${wrap("(", join(variableDefinitions, ", "), ")")} on ${typeCondition} ${wrap("", join(directives, " "), " ")}` + selectionSet
|
|
679
|
-
)
|
|
680
|
-
},
|
|
681
|
-
// Value
|
|
682
|
-
IntValue: {
|
|
683
|
-
leave: ({ value }) => value
|
|
684
|
-
},
|
|
685
|
-
FloatValue: {
|
|
686
|
-
leave: ({ value }) => value
|
|
687
|
-
},
|
|
688
|
-
StringValue: {
|
|
689
|
-
leave: ({ value, block: isBlockString }) => isBlockString ? printBlockString(value) : printString(value)
|
|
690
|
-
},
|
|
691
|
-
BooleanValue: {
|
|
692
|
-
leave: ({ value }) => value ? "true" : "false"
|
|
693
|
-
},
|
|
694
|
-
NullValue: {
|
|
695
|
-
leave: () => "null"
|
|
696
|
-
},
|
|
697
|
-
EnumValue: {
|
|
698
|
-
leave: ({ value }) => value
|
|
699
|
-
},
|
|
700
|
-
ListValue: {
|
|
701
|
-
leave: ({ values }) => "[" + join(values, ", ") + "]"
|
|
702
|
-
},
|
|
703
|
-
ObjectValue: {
|
|
704
|
-
leave: ({ fields }) => "{" + join(fields, ", ") + "}"
|
|
705
|
-
},
|
|
706
|
-
ObjectField: {
|
|
707
|
-
leave: ({ name, value }) => name + ": " + value
|
|
708
|
-
},
|
|
709
|
-
// Directive
|
|
710
|
-
Directive: {
|
|
711
|
-
leave: ({ name, arguments: args }) => "@" + name + wrap("(", join(args, ", "), ")")
|
|
712
|
-
},
|
|
713
|
-
// Type
|
|
714
|
-
NamedType: {
|
|
715
|
-
leave: ({ name }) => name
|
|
716
|
-
},
|
|
717
|
-
ListType: {
|
|
718
|
-
leave: ({ type }) => "[" + type + "]"
|
|
719
|
-
},
|
|
720
|
-
NonNullType: {
|
|
721
|
-
leave: ({ type }) => type + "!"
|
|
722
|
-
},
|
|
723
|
-
// Type System Definitions
|
|
724
|
-
SchemaDefinition: {
|
|
725
|
-
leave: ({ description, directives, operationTypes }) => wrap("", description, "\n") + join(["schema", join(directives, " "), block(operationTypes)], " ")
|
|
726
|
-
},
|
|
727
|
-
OperationTypeDefinition: {
|
|
728
|
-
leave: ({ operation, type }) => operation + ": " + type
|
|
729
|
-
},
|
|
730
|
-
ScalarTypeDefinition: {
|
|
731
|
-
leave: ({ description, name, directives }) => wrap("", description, "\n") + join(["scalar", name, join(directives, " ")], " ")
|
|
732
|
-
},
|
|
733
|
-
ObjectTypeDefinition: {
|
|
734
|
-
leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join(
|
|
735
|
-
[
|
|
736
|
-
"type",
|
|
737
|
-
name,
|
|
738
|
-
wrap("implements ", join(interfaces, " & ")),
|
|
739
|
-
join(directives, " "),
|
|
740
|
-
block(fields)
|
|
741
|
-
],
|
|
742
|
-
" "
|
|
743
|
-
)
|
|
744
|
-
},
|
|
745
|
-
FieldDefinition: {
|
|
746
|
-
leave: ({ description, name, arguments: args, type, directives }) => wrap("", description, "\n") + name + (hasMultilineItems(args) ? wrap("(\n", indent(join(args, "\n")), "\n)") : wrap("(", join(args, ", "), ")")) + ": " + type + wrap(" ", join(directives, " "))
|
|
747
|
-
},
|
|
748
|
-
InputValueDefinition: {
|
|
749
|
-
leave: ({ description, name, type, defaultValue, directives }) => wrap("", description, "\n") + join(
|
|
750
|
-
[name + ": " + type, wrap("= ", defaultValue), join(directives, " ")],
|
|
751
|
-
" "
|
|
752
|
-
)
|
|
753
|
-
},
|
|
754
|
-
InterfaceTypeDefinition: {
|
|
755
|
-
leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join(
|
|
756
|
-
[
|
|
757
|
-
"interface",
|
|
758
|
-
name,
|
|
759
|
-
wrap("implements ", join(interfaces, " & ")),
|
|
760
|
-
join(directives, " "),
|
|
761
|
-
block(fields)
|
|
762
|
-
],
|
|
763
|
-
" "
|
|
764
|
-
)
|
|
765
|
-
},
|
|
766
|
-
UnionTypeDefinition: {
|
|
767
|
-
leave: ({ description, name, directives, types }) => wrap("", description, "\n") + join(
|
|
768
|
-
["union", name, join(directives, " "), wrap("= ", join(types, " | "))],
|
|
769
|
-
" "
|
|
770
|
-
)
|
|
771
|
-
},
|
|
772
|
-
EnumTypeDefinition: {
|
|
773
|
-
leave: ({ description, name, directives, values }) => wrap("", description, "\n") + join(["enum", name, join(directives, " "), block(values)], " ")
|
|
774
|
-
},
|
|
775
|
-
EnumValueDefinition: {
|
|
776
|
-
leave: ({ description, name, directives }) => wrap("", description, "\n") + join([name, join(directives, " ")], " ")
|
|
777
|
-
},
|
|
778
|
-
InputObjectTypeDefinition: {
|
|
779
|
-
leave: ({ description, name, directives, fields }) => wrap("", description, "\n") + join(["input", name, join(directives, " "), block(fields)], " ")
|
|
780
|
-
},
|
|
781
|
-
DirectiveDefinition: {
|
|
782
|
-
leave: ({ description, name, arguments: args, repeatable, locations }) => wrap("", description, "\n") + "directive @" + name + (hasMultilineItems(args) ? wrap("(\n", indent(join(args, "\n")), "\n)") : wrap("(", join(args, ", "), ")")) + (repeatable ? " repeatable" : "") + " on " + join(locations, " | ")
|
|
783
|
-
},
|
|
784
|
-
SchemaExtension: {
|
|
785
|
-
leave: ({ directives, operationTypes }) => join(
|
|
786
|
-
["extend schema", join(directives, " "), block(operationTypes)],
|
|
787
|
-
" "
|
|
788
|
-
)
|
|
789
|
-
},
|
|
790
|
-
ScalarTypeExtension: {
|
|
791
|
-
leave: ({ name, directives }) => join(["extend scalar", name, join(directives, " ")], " ")
|
|
792
|
-
},
|
|
793
|
-
ObjectTypeExtension: {
|
|
794
|
-
leave: ({ name, interfaces, directives, fields }) => join(
|
|
795
|
-
[
|
|
796
|
-
"extend type",
|
|
797
|
-
name,
|
|
798
|
-
wrap("implements ", join(interfaces, " & ")),
|
|
799
|
-
join(directives, " "),
|
|
800
|
-
block(fields)
|
|
801
|
-
],
|
|
802
|
-
" "
|
|
803
|
-
)
|
|
804
|
-
},
|
|
805
|
-
InterfaceTypeExtension: {
|
|
806
|
-
leave: ({ name, interfaces, directives, fields }) => join(
|
|
807
|
-
[
|
|
808
|
-
"extend interface",
|
|
809
|
-
name,
|
|
810
|
-
wrap("implements ", join(interfaces, " & ")),
|
|
811
|
-
join(directives, " "),
|
|
812
|
-
block(fields)
|
|
813
|
-
],
|
|
814
|
-
" "
|
|
815
|
-
)
|
|
816
|
-
},
|
|
817
|
-
UnionTypeExtension: {
|
|
818
|
-
leave: ({ name, directives, types }) => join(
|
|
819
|
-
[
|
|
820
|
-
"extend union",
|
|
821
|
-
name,
|
|
822
|
-
join(directives, " "),
|
|
823
|
-
wrap("= ", join(types, " | "))
|
|
824
|
-
],
|
|
825
|
-
" "
|
|
826
|
-
)
|
|
827
|
-
},
|
|
828
|
-
EnumTypeExtension: {
|
|
829
|
-
leave: ({ name, directives, values }) => join(["extend enum", name, join(directives, " "), block(values)], " ")
|
|
830
|
-
},
|
|
831
|
-
InputObjectTypeExtension: {
|
|
832
|
-
leave: ({ name, directives, fields }) => join(["extend input", name, join(directives, " "), block(fields)], " ")
|
|
833
|
-
}
|
|
834
|
-
};
|
|
835
|
-
function join(maybeArray, separator = "") {
|
|
836
|
-
var _maybeArray$filter$jo;
|
|
837
|
-
return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter((x) => x).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : "";
|
|
838
|
-
}
|
|
839
|
-
function block(array) {
|
|
840
|
-
return wrap("{\n", indent(join(array, "\n")), "\n}");
|
|
841
|
-
}
|
|
842
|
-
function wrap(start, maybeString, end = "") {
|
|
843
|
-
return maybeString != null && maybeString !== "" ? start + maybeString + end : "";
|
|
844
|
-
}
|
|
845
|
-
function indent(str) {
|
|
846
|
-
return wrap(" ", str.replace(/\n/g, "\n "));
|
|
847
|
-
}
|
|
848
|
-
function hasMultilineItems(maybeArray) {
|
|
849
|
-
var _maybeArray$some;
|
|
850
|
-
return (_maybeArray$some = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.some((str) => str.includes("\n"))) !== null && _maybeArray$some !== void 0 ? _maybeArray$some : false;
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
// src/transport/core/token-refresh.ts
|
|
854
|
-
var inFlightRefreshes = /* @__PURE__ */ new WeakMap();
|
|
855
|
-
async function refreshTokenSingleFlight(getToken, failedToken) {
|
|
856
|
-
let inFlight = inFlightRefreshes.get(getToken);
|
|
857
|
-
if (!inFlight) {
|
|
858
|
-
const refreshPromise = getToken({ forceRefresh: true }).finally(() => {
|
|
859
|
-
if (inFlightRefreshes.get(getToken) === refreshPromise) {
|
|
860
|
-
inFlightRefreshes.delete(getToken);
|
|
861
|
-
}
|
|
862
|
-
});
|
|
863
|
-
inFlightRefreshes.set(getToken, refreshPromise);
|
|
864
|
-
inFlight = refreshPromise;
|
|
865
|
-
}
|
|
866
|
-
const refreshedToken = await inFlight;
|
|
867
|
-
if (failedToken && refreshedToken === failedToken) {
|
|
868
|
-
throw new DvinaAuthenticationError("Token refresh did not produce a new token", failedToken);
|
|
869
|
-
}
|
|
870
|
-
return refreshedToken;
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
// src/transport/http.ts
|
|
874
|
-
var printCache = /* @__PURE__ */ new WeakMap();
|
|
875
|
-
function printDocument(document) {
|
|
876
|
-
let cached = printCache.get(document);
|
|
877
|
-
if (!cached) {
|
|
878
|
-
cached = print(document);
|
|
879
|
-
printCache.set(document, cached);
|
|
880
|
-
}
|
|
881
|
-
return cached;
|
|
882
|
-
}
|
|
883
|
-
var NON_AUTH_CODES = /* @__PURE__ */ new Set([
|
|
884
|
-
GRAPHQL_ERROR_CODES.SESSION_TOKEN_LIMIT_REACHED,
|
|
885
|
-
GRAPHQL_ERROR_CODES.STORAGE_LIMIT_REACHED,
|
|
886
|
-
GRAPHQL_ERROR_CODES.DEEP_ANALYSIS_LIMIT_EXCEEDED,
|
|
887
|
-
GRAPHQL_ERROR_CODES.PLAN_DETAIL_RESTRICTION,
|
|
888
|
-
GRAPHQL_ERROR_CODES.RESOURCE_NOT_FOUND
|
|
889
|
-
]);
|
|
890
|
-
function isAuthError(errors, status) {
|
|
891
|
-
if (errors) {
|
|
892
|
-
for (const err of errors) {
|
|
893
|
-
const rawCode = err.extensions?.["code"];
|
|
894
|
-
if (rawCode === void 0 || rawCode === null) continue;
|
|
895
|
-
if (rawCode === 4401 || rawCode === "4401") return true;
|
|
896
|
-
const code = String(rawCode).toUpperCase();
|
|
897
|
-
if (NON_AUTH_CODES.has(code)) return false;
|
|
898
|
-
if (code === "UNAUTHORIZED" || code === "UNAUTHENTICATED" || err.message === "Unauthorized") {
|
|
899
|
-
return true;
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
return false;
|
|
904
|
-
}
|
|
905
|
-
async function doFetch(options, document, variables) {
|
|
906
|
-
const token = await options.getToken();
|
|
907
|
-
const lang = options.getLanguage();
|
|
908
|
-
const platform = options.getPlatform?.();
|
|
909
|
-
const userTimezone = options.getUserTimezone?.();
|
|
910
|
-
const headers = {
|
|
911
|
-
"Content-Type": "application/json",
|
|
912
|
-
Authorization: `Bearer ${token}`
|
|
913
|
-
};
|
|
914
|
-
if (lang) {
|
|
915
|
-
headers["x-preferred-language"] = lang;
|
|
916
|
-
}
|
|
917
|
-
if (platform) {
|
|
918
|
-
headers["x-platform"] = platform;
|
|
919
|
-
}
|
|
920
|
-
if (userTimezone) {
|
|
921
|
-
headers["x-user-timezone"] = userTimezone;
|
|
922
|
-
}
|
|
923
|
-
const body = JSON.stringify({
|
|
924
|
-
query: printDocument(document),
|
|
925
|
-
variables
|
|
926
|
-
});
|
|
927
|
-
let response;
|
|
928
|
-
try {
|
|
929
|
-
response = await fetch(options.url, {
|
|
930
|
-
method: "POST",
|
|
931
|
-
headers,
|
|
932
|
-
body
|
|
933
|
-
});
|
|
934
|
-
} catch (error) {
|
|
935
|
-
if (error instanceof Error && error.name === "AbortError") {
|
|
936
|
-
throw error;
|
|
937
|
-
}
|
|
938
|
-
throw new DvinaNetworkError(
|
|
939
|
-
error instanceof Error ? error.message : "Network request failed before reaching the server",
|
|
940
|
-
0
|
|
941
|
-
);
|
|
942
|
-
}
|
|
943
|
-
if (!response.ok) {
|
|
944
|
-
if (response.status === 401 || response.status === 403) {
|
|
945
|
-
throw new DvinaAuthenticationError(`Authentication failed with status ${response.status}`, token);
|
|
946
|
-
}
|
|
947
|
-
throw new DvinaNetworkError(`HTTP ${response.status}: ${response.statusText}`, response.status);
|
|
948
|
-
}
|
|
949
|
-
return { response: await response.json(), usedToken: token };
|
|
950
|
-
}
|
|
951
|
-
var MAX_RETRIES = 4;
|
|
952
|
-
var RETRY_DELAY_MS = 1e3;
|
|
953
|
-
function createHttpTransport(options) {
|
|
954
|
-
async function requestWithRetry(document, variables, attempt = 0) {
|
|
955
|
-
let fetchResult;
|
|
956
|
-
try {
|
|
957
|
-
fetchResult = await doFetch(options, document, variables);
|
|
958
|
-
} catch (error) {
|
|
959
|
-
if (error instanceof DvinaAuthenticationError) {
|
|
960
|
-
return handleAuthRefresh(document, variables, options, error.failedToken);
|
|
961
|
-
}
|
|
962
|
-
if (error instanceof DvinaNetworkError && error.status === 0 && attempt < MAX_RETRIES) {
|
|
963
|
-
await sleep(RETRY_DELAY_MS * (attempt + 1));
|
|
964
|
-
return requestWithRetry(document, variables, attempt + 1);
|
|
965
|
-
}
|
|
966
|
-
if (error instanceof DvinaError) options.onError?.(error);
|
|
967
|
-
throw error;
|
|
968
|
-
}
|
|
969
|
-
const { response: result, usedToken } = fetchResult;
|
|
970
|
-
if (isAuthError(result.errors)) {
|
|
971
|
-
return handleAuthRefresh(document, variables, options, usedToken);
|
|
972
|
-
}
|
|
973
|
-
if (result.errors?.length && !result.data) {
|
|
974
|
-
const error = createGraphQLError(result.errors, printDocument(document), variables);
|
|
975
|
-
options.onError?.(error);
|
|
976
|
-
throw error;
|
|
977
|
-
}
|
|
978
|
-
if (!result.data) {
|
|
979
|
-
const error = createGraphQLError(
|
|
980
|
-
[{ message: "No data returned from server" }],
|
|
981
|
-
printDocument(document),
|
|
982
|
-
variables
|
|
983
|
-
);
|
|
984
|
-
options.onError?.(error);
|
|
985
|
-
throw error;
|
|
986
|
-
}
|
|
987
|
-
return result.data;
|
|
988
|
-
}
|
|
989
|
-
return {
|
|
990
|
-
request: (document, variables) => requestWithRetry(document, variables)
|
|
991
|
-
};
|
|
992
|
-
}
|
|
993
|
-
async function handleAuthRefresh(document, variables, options, failedToken) {
|
|
994
|
-
try {
|
|
995
|
-
await refreshTokenSingleFlight(options.getToken, failedToken);
|
|
996
|
-
} catch {
|
|
997
|
-
const error = new DvinaAuthenticationError("Token refresh failed");
|
|
998
|
-
options.onError?.(error);
|
|
999
|
-
throw error;
|
|
1000
|
-
}
|
|
1001
|
-
return retryAfterRefresh(options, document, variables);
|
|
1002
|
-
}
|
|
1003
|
-
async function retryAfterRefresh(options, document, variables) {
|
|
1004
|
-
const { response: result } = await doFetch(options, document, variables);
|
|
1005
|
-
if (isAuthError(result.errors)) {
|
|
1006
|
-
const error = new DvinaAuthenticationError("Authentication failed after token refresh");
|
|
1007
|
-
options.onError?.(error);
|
|
1008
|
-
throw error;
|
|
1009
|
-
}
|
|
1010
|
-
if (result.errors?.length && !result.data) {
|
|
1011
|
-
const error = createGraphQLError(result.errors, printDocument(document), variables);
|
|
1012
|
-
options.onError?.(error);
|
|
1013
|
-
throw error;
|
|
1014
|
-
}
|
|
1015
|
-
return result.data;
|
|
1016
|
-
}
|
|
1017
|
-
function sleep(ms) {
|
|
1018
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
// src/transport/core/connection-supervisor.ts
|
|
1022
|
-
var DEFAULT_AUTH_RETRY_DELAY_MS = 1e3;
|
|
1023
|
-
var DEFAULT_BASE_RECONNECT_DELAY_MS = 1e3;
|
|
1024
|
-
var DEFAULT_MAX_CONSECUTIVE_AUTH_FAILURES = 3;
|
|
1025
|
-
var DEFAULT_MAX_RECONNECT_DELAY_MS = 3e4;
|
|
1026
|
-
function isAbortError(error) {
|
|
1027
|
-
return error instanceof Error && error.name === "AbortError";
|
|
1028
|
-
}
|
|
1029
|
-
function now() {
|
|
1030
|
-
return Date.now();
|
|
1031
|
-
}
|
|
1032
|
-
var ConnectionSupervisor = class {
|
|
1033
|
-
constructor(options) {
|
|
1034
|
-
this.options = options;
|
|
1035
|
-
}
|
|
1036
|
-
abortController;
|
|
1037
|
-
abortReason;
|
|
1038
|
-
attemptPromise;
|
|
1039
|
-
closed = false;
|
|
1040
|
-
consecutiveAuthFailures = 0;
|
|
1041
|
-
forceRefreshNext = false;
|
|
1042
|
-
lastActivityAt = null;
|
|
1043
|
-
lastConnectedAt = null;
|
|
1044
|
-
lastError;
|
|
1045
|
-
reconnectAttempt = 0;
|
|
1046
|
-
reconnectTimer;
|
|
1047
|
-
restartAfterCurrentAttempt = false;
|
|
1048
|
-
state = "idle";
|
|
1049
|
-
staleTimer;
|
|
1050
|
-
shouldRun = false;
|
|
1051
|
-
get snapshot() {
|
|
1052
|
-
return {
|
|
1053
|
-
consecutiveAuthFailures: this.consecutiveAuthFailures,
|
|
1054
|
-
id: this.options.id,
|
|
1055
|
-
kind: this.options.kind,
|
|
1056
|
-
lastActivityAt: this.lastActivityAt,
|
|
1057
|
-
lastConnectedAt: this.lastConnectedAt,
|
|
1058
|
-
lastError: this.lastError,
|
|
1059
|
-
reconnectAttempt: this.reconnectAttempt,
|
|
1060
|
-
state: this.state
|
|
1061
|
-
};
|
|
1062
|
-
}
|
|
1063
|
-
async start() {
|
|
1064
|
-
if (this.closed) {
|
|
1065
|
-
throw new Error(`Connection '${this.options.kind}:${this.options.id}' is closed`);
|
|
1066
|
-
}
|
|
1067
|
-
this.shouldRun = true;
|
|
1068
|
-
this.clearReconnectTimer();
|
|
1069
|
-
if (this.attemptPromise && this.abortReason) {
|
|
1070
|
-
this.restartAfterCurrentAttempt = true;
|
|
1071
|
-
}
|
|
1072
|
-
return this.ensureAttempt();
|
|
1073
|
-
}
|
|
1074
|
-
stop() {
|
|
1075
|
-
this.shouldRun = false;
|
|
1076
|
-
this.restartAfterCurrentAttempt = false;
|
|
1077
|
-
this.clearReconnectTimer();
|
|
1078
|
-
this.clearStaleTimer();
|
|
1079
|
-
this.abort("manual");
|
|
1080
|
-
this.setState("idle");
|
|
1081
|
-
}
|
|
1082
|
-
close() {
|
|
1083
|
-
this.closed = true;
|
|
1084
|
-
this.shouldRun = false;
|
|
1085
|
-
this.restartAfterCurrentAttempt = false;
|
|
1086
|
-
this.clearReconnectTimer();
|
|
1087
|
-
this.clearStaleTimer();
|
|
1088
|
-
this.abort("manual");
|
|
1089
|
-
this.setState("closed");
|
|
1090
|
-
}
|
|
1091
|
-
reconnect() {
|
|
1092
|
-
if (this.closed) {
|
|
1093
|
-
return;
|
|
1094
|
-
}
|
|
1095
|
-
this.shouldRun = true;
|
|
1096
|
-
this.clearReconnectTimer();
|
|
1097
|
-
this.clearStaleTimer();
|
|
1098
|
-
if (this.abortController) {
|
|
1099
|
-
this.restartAfterCurrentAttempt = true;
|
|
1100
|
-
this.abort("restart");
|
|
1101
|
-
return;
|
|
1102
|
-
}
|
|
1103
|
-
void this.ensureAttempt();
|
|
1104
|
-
}
|
|
1105
|
-
ensureAttempt() {
|
|
1106
|
-
if (!this.shouldRun || this.closed) {
|
|
1107
|
-
return Promise.resolve();
|
|
1108
|
-
}
|
|
1109
|
-
if (!this.attemptPromise) {
|
|
1110
|
-
const attemptPromise = this.runAttempt().finally(() => {
|
|
1111
|
-
if (this.attemptPromise === attemptPromise) {
|
|
1112
|
-
this.attemptPromise = void 0;
|
|
1113
|
-
}
|
|
1114
|
-
});
|
|
1115
|
-
this.attemptPromise = attemptPromise;
|
|
1116
|
-
}
|
|
1117
|
-
return this.attemptPromise;
|
|
1118
|
-
}
|
|
1119
|
-
async runAttempt() {
|
|
1120
|
-
if (!this.shouldRun || this.closed) {
|
|
1121
|
-
return;
|
|
1122
|
-
}
|
|
1123
|
-
const isReconnect = this.lastConnectedAt !== null || this.reconnectAttempt > 0;
|
|
1124
|
-
this.setState("connecting");
|
|
1125
|
-
this.lastError = void 0;
|
|
1126
|
-
this.abortReason = void 0;
|
|
1127
|
-
const abortController = new AbortController();
|
|
1128
|
-
this.abortController = abortController;
|
|
1129
|
-
try {
|
|
1130
|
-
const token = this.forceRefreshNext ? await refreshTokenSingleFlight(this.options.getToken) : await this.options.getToken(void 0);
|
|
1131
|
-
this.forceRefreshNext = false;
|
|
1132
|
-
await this.options.dial({
|
|
1133
|
-
isReconnect,
|
|
1134
|
-
markActivity: () => this.markActivity(),
|
|
1135
|
-
markConnected: () => this.markConnected(),
|
|
1136
|
-
requestTokenRefresh: () => {
|
|
1137
|
-
this.forceRefreshNext = true;
|
|
1138
|
-
},
|
|
1139
|
-
signal: abortController.signal,
|
|
1140
|
-
token
|
|
1141
|
-
});
|
|
1142
|
-
if (!this.shouldRun || this.closed) {
|
|
1143
|
-
return;
|
|
1144
|
-
}
|
|
1145
|
-
this.scheduleReconnect("end");
|
|
1146
|
-
} catch (error) {
|
|
1147
|
-
if (isAbortError(error)) {
|
|
1148
|
-
if (this.abortReason === "stale" && this.shouldRun && !this.closed) {
|
|
1149
|
-
this.scheduleReconnect("end");
|
|
1150
|
-
}
|
|
1151
|
-
return;
|
|
1152
|
-
}
|
|
1153
|
-
if (!this.shouldRun || this.closed) {
|
|
1154
|
-
return;
|
|
1155
|
-
}
|
|
1156
|
-
this.handleFailure(error);
|
|
1157
|
-
} finally {
|
|
1158
|
-
if (this.abortController === abortController) {
|
|
1159
|
-
this.abortController = void 0;
|
|
1160
|
-
}
|
|
1161
|
-
this.abortReason = void 0;
|
|
1162
|
-
if (this.restartAfterCurrentAttempt && this.shouldRun && !this.closed) {
|
|
1163
|
-
this.restartAfterCurrentAttempt = false;
|
|
1164
|
-
queueMicrotask(() => {
|
|
1165
|
-
if (!this.closed && this.shouldRun) {
|
|
1166
|
-
void this.ensureAttempt();
|
|
1167
|
-
}
|
|
1168
|
-
});
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
handleFailure(error) {
|
|
1173
|
-
this.lastError = error;
|
|
1174
|
-
if (error instanceof DvinaAuthenticationError) {
|
|
1175
|
-
this.shouldRun = false;
|
|
1176
|
-
this.clearReconnectTimer();
|
|
1177
|
-
this.clearStaleTimer();
|
|
1178
|
-
this.setState("failed");
|
|
1179
|
-
this.options.onFatalError?.(error);
|
|
1180
|
-
return;
|
|
1181
|
-
}
|
|
1182
|
-
const isAuthError2 = this.options.isAuthError?.(error) ?? false;
|
|
1183
|
-
if (isAuthError2) {
|
|
1184
|
-
this.consecutiveAuthFailures += 1;
|
|
1185
|
-
this.forceRefreshNext = true;
|
|
1186
|
-
this.setState("reconnecting");
|
|
1187
|
-
if (this.consecutiveAuthFailures >= (this.options.maxConsecutiveAuthFailures ?? DEFAULT_MAX_CONSECUTIVE_AUTH_FAILURES)) {
|
|
1188
|
-
this.shouldRun = false;
|
|
1189
|
-
this.clearReconnectTimer();
|
|
1190
|
-
this.clearStaleTimer();
|
|
1191
|
-
this.setState("failed");
|
|
1192
|
-
this.options.onFatalError?.(error);
|
|
1193
|
-
return;
|
|
1194
|
-
}
|
|
1195
|
-
this.scheduleReconnect("auth");
|
|
1196
|
-
return;
|
|
1197
|
-
}
|
|
1198
|
-
this.consecutiveAuthFailures = 0;
|
|
1199
|
-
if (typeof navigator !== "undefined" && "onLine" in navigator && navigator.onLine === false) {
|
|
1200
|
-
this.setState("offline");
|
|
1201
|
-
} else {
|
|
1202
|
-
this.setState("reconnecting");
|
|
1203
|
-
}
|
|
1204
|
-
this.scheduleReconnect("failure");
|
|
1205
|
-
}
|
|
1206
|
-
scheduleReconnect(reason) {
|
|
1207
|
-
if (!this.shouldRun || this.closed) {
|
|
1208
|
-
return;
|
|
1209
|
-
}
|
|
1210
|
-
this.clearReconnectTimer();
|
|
1211
|
-
this.clearStaleTimer();
|
|
1212
|
-
const delay = reason === "auth" ? this.options.authRetryDelayMs ?? DEFAULT_AUTH_RETRY_DELAY_MS : reason === "failure" ? this.nextReconnectDelay() : this.options.baseReconnectDelayMs ?? DEFAULT_BASE_RECONNECT_DELAY_MS;
|
|
1213
|
-
this.reconnectTimer = setTimeout(() => {
|
|
1214
|
-
this.reconnectTimer = void 0;
|
|
1215
|
-
void this.ensureAttempt();
|
|
1216
|
-
}, delay);
|
|
1217
|
-
}
|
|
1218
|
-
nextReconnectDelay() {
|
|
1219
|
-
const baseDelay = this.options.baseReconnectDelayMs ?? DEFAULT_BASE_RECONNECT_DELAY_MS;
|
|
1220
|
-
const maxDelay = this.options.maxReconnectDelayMs ?? DEFAULT_MAX_RECONNECT_DELAY_MS;
|
|
1221
|
-
const cappedDelay = Math.min(baseDelay * Math.pow(2, this.reconnectAttempt), maxDelay);
|
|
1222
|
-
this.reconnectAttempt += 1;
|
|
1223
|
-
if (this.options.jitter === "full") {
|
|
1224
|
-
return Math.floor(Math.random() * cappedDelay);
|
|
1225
|
-
}
|
|
1226
|
-
return cappedDelay;
|
|
1227
|
-
}
|
|
1228
|
-
markConnected() {
|
|
1229
|
-
this.consecutiveAuthFailures = 0;
|
|
1230
|
-
this.reconnectAttempt = 0;
|
|
1231
|
-
this.lastConnectedAt = now();
|
|
1232
|
-
this.setState("connected");
|
|
1233
|
-
this.markActivity();
|
|
1234
|
-
}
|
|
1235
|
-
markActivity() {
|
|
1236
|
-
this.lastActivityAt = now();
|
|
1237
|
-
this.armStaleTimer();
|
|
1238
|
-
}
|
|
1239
|
-
armStaleTimer() {
|
|
1240
|
-
this.clearStaleTimer();
|
|
1241
|
-
const staleTimeoutMs = this.options.staleTimeoutMs;
|
|
1242
|
-
if (!staleTimeoutMs || staleTimeoutMs <= 0 || this.state !== "connected") {
|
|
1243
|
-
return;
|
|
1244
|
-
}
|
|
1245
|
-
this.staleTimer = setTimeout(() => {
|
|
1246
|
-
if (!this.shouldRun || this.closed || !this.abortController) {
|
|
1247
|
-
return;
|
|
1248
|
-
}
|
|
1249
|
-
this.setState("stale");
|
|
1250
|
-
this.abort("stale");
|
|
1251
|
-
}, staleTimeoutMs);
|
|
1252
|
-
}
|
|
1253
|
-
clearReconnectTimer() {
|
|
1254
|
-
if (!this.reconnectTimer) {
|
|
1255
|
-
return;
|
|
1256
|
-
}
|
|
1257
|
-
clearTimeout(this.reconnectTimer);
|
|
1258
|
-
this.reconnectTimer = void 0;
|
|
1259
|
-
}
|
|
1260
|
-
clearStaleTimer() {
|
|
1261
|
-
if (!this.staleTimer) {
|
|
1262
|
-
return;
|
|
1263
|
-
}
|
|
1264
|
-
clearTimeout(this.staleTimer);
|
|
1265
|
-
this.staleTimer = void 0;
|
|
1266
|
-
}
|
|
1267
|
-
abort(reason) {
|
|
1268
|
-
if (!this.abortController) {
|
|
1269
|
-
return;
|
|
1270
|
-
}
|
|
1271
|
-
this.abortReason = reason;
|
|
1272
|
-
this.abortController.abort();
|
|
1273
|
-
this.abortController = void 0;
|
|
1274
|
-
}
|
|
1275
|
-
setState(nextState) {
|
|
1276
|
-
if (this.state === nextState) {
|
|
1277
|
-
return;
|
|
1278
|
-
}
|
|
1279
|
-
this.state = nextState;
|
|
1280
|
-
this.options.onStateChange?.(this.snapshot);
|
|
1281
|
-
}
|
|
1282
|
-
};
|
|
1283
|
-
|
|
1284
|
-
// src/transport/core/sse-stream.ts
|
|
1285
|
-
async function consumeSseStream(body, signal, handlers) {
|
|
1286
|
-
const reader = body.getReader();
|
|
1287
|
-
const decoder = new TextDecoder();
|
|
1288
|
-
let buffer = "";
|
|
1289
|
-
try {
|
|
1290
|
-
while (!signal.aborted) {
|
|
1291
|
-
const { done, value } = await reader.read();
|
|
1292
|
-
if (done) {
|
|
1293
|
-
break;
|
|
1294
|
-
}
|
|
1295
|
-
handlers.onChunk?.();
|
|
1296
|
-
buffer += decoder.decode(value, { stream: true });
|
|
1297
|
-
const parts = buffer.split(/(?:\r\n|\r|\n){2}/);
|
|
1298
|
-
buffer = parts.pop() ?? "";
|
|
1299
|
-
for (const part of parts) {
|
|
1300
|
-
handlers.onEventBlock(part.trim());
|
|
1301
|
-
}
|
|
1302
|
-
}
|
|
1303
|
-
} finally {
|
|
1304
|
-
reader.releaseLock();
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
// src/billing/client.ts
|
|
1309
|
-
var INITIAL_RECONNECT_DELAY_MS = 1e3;
|
|
1310
|
-
var MAX_RECONNECT_DELAY_MS = 3e4;
|
|
1311
|
-
var MAX_CONSECUTIVE_AUTH_FAILURES = 3;
|
|
1312
|
-
var STALE_CONNECTION_TIMEOUT_MS = 35e3;
|
|
1313
|
-
var BillingAuthStreamError = class extends Error {
|
|
1314
|
-
constructor(status) {
|
|
1315
|
-
super(`Billing SSE auth failed: ${status}`);
|
|
1316
|
-
this.status = status;
|
|
1317
|
-
this.name = "BillingAuthStreamError";
|
|
1318
|
-
}
|
|
1319
|
-
};
|
|
1320
|
-
var BillingSubscriptionStream = class {
|
|
1321
|
-
constructor(options, onClose) {
|
|
1322
|
-
this.options = options;
|
|
1323
|
-
this.onClose = onClose;
|
|
1324
|
-
this.supervisor = new ConnectionSupervisor({
|
|
1325
|
-
authRetryDelayMs: INITIAL_RECONNECT_DELAY_MS,
|
|
1326
|
-
baseReconnectDelayMs: INITIAL_RECONNECT_DELAY_MS,
|
|
1327
|
-
getToken: options.getToken,
|
|
1328
|
-
id: `billing-${Math.random().toString(36).slice(2)}`,
|
|
1329
|
-
isAuthError: (error) => error instanceof BillingAuthStreamError,
|
|
1330
|
-
kind: "billing-sse",
|
|
1331
|
-
maxConsecutiveAuthFailures: MAX_CONSECUTIVE_AUTH_FAILURES,
|
|
1332
|
-
maxReconnectDelayMs: MAX_RECONNECT_DELAY_MS,
|
|
1333
|
-
onFatalError: () => {
|
|
1334
|
-
this.options.onError?.(
|
|
1335
|
-
new DvinaAuthenticationError("Billing SSE stream authentication failed permanently")
|
|
1336
|
-
);
|
|
1337
|
-
this.close();
|
|
1338
|
-
},
|
|
1339
|
-
staleTimeoutMs: STALE_CONNECTION_TIMEOUT_MS,
|
|
1340
|
-
dial: async (context) => {
|
|
1341
|
-
const response = await fetch(this.options.billingSseUrl, {
|
|
1342
|
-
method: "GET",
|
|
1343
|
-
headers: {
|
|
1344
|
-
Authorization: `Bearer ${context.token}`,
|
|
1345
|
-
Accept: "text/event-stream",
|
|
1346
|
-
"Cache-Control": "no-cache"
|
|
1347
|
-
},
|
|
1348
|
-
signal: context.signal
|
|
1349
|
-
});
|
|
1350
|
-
if (!response.ok) {
|
|
1351
|
-
if (response.status === 401 || response.status === 403) {
|
|
1352
|
-
throw new BillingAuthStreamError(response.status);
|
|
1353
|
-
}
|
|
1354
|
-
throw new Error(`Billing SSE failed: ${response.status} ${response.statusText}`);
|
|
1355
|
-
}
|
|
1356
|
-
if (!response.body) {
|
|
1357
|
-
throw new Error("Billing SSE response has no body");
|
|
1358
|
-
}
|
|
1359
|
-
context.markConnected();
|
|
1360
|
-
await consumeSseStream(response.body, context.signal, {
|
|
1361
|
-
onChunk: () => context.markActivity(),
|
|
1362
|
-
onEventBlock: (block2) => this.processEventBlock(block2, context.requestTokenRefresh)
|
|
1363
|
-
});
|
|
1364
|
-
}
|
|
1365
|
-
});
|
|
1366
|
-
}
|
|
1367
|
-
abortFinished = false;
|
|
1368
|
-
queue = [];
|
|
1369
|
-
pendingResolve = null;
|
|
1370
|
-
supervisor;
|
|
1371
|
-
start() {
|
|
1372
|
-
void this.supervisor.start();
|
|
1373
|
-
}
|
|
1374
|
-
reconnect() {
|
|
1375
|
-
if (this.abortFinished) {
|
|
1376
|
-
return;
|
|
1377
|
-
}
|
|
1378
|
-
this.supervisor.reconnect();
|
|
1379
|
-
}
|
|
1380
|
-
next() {
|
|
1381
|
-
if (this.queue.length > 0) {
|
|
1382
|
-
return Promise.resolve({ value: this.queue.shift(), done: false });
|
|
1383
|
-
}
|
|
1384
|
-
if (this.abortFinished) {
|
|
1385
|
-
return Promise.resolve({ value: void 0, done: true });
|
|
1386
|
-
}
|
|
1387
|
-
return new Promise((resolve) => {
|
|
1388
|
-
this.pendingResolve = resolve;
|
|
1389
|
-
});
|
|
1390
|
-
}
|
|
1391
|
-
return() {
|
|
1392
|
-
this.close();
|
|
1393
|
-
return Promise.resolve({ value: void 0, done: true });
|
|
1394
|
-
}
|
|
1395
|
-
[Symbol.asyncIterator]() {
|
|
1396
|
-
return this;
|
|
1397
|
-
}
|
|
1398
|
-
close() {
|
|
1399
|
-
if (this.abortFinished) {
|
|
1400
|
-
return;
|
|
1401
|
-
}
|
|
1402
|
-
this.abortFinished = true;
|
|
1403
|
-
this.supervisor.close();
|
|
1404
|
-
if (this.pendingResolve) {
|
|
1405
|
-
this.pendingResolve({ value: void 0, done: true });
|
|
1406
|
-
this.pendingResolve = null;
|
|
1407
|
-
}
|
|
1408
|
-
this.onClose(this);
|
|
1409
|
-
}
|
|
1410
|
-
push(value) {
|
|
1411
|
-
if (this.abortFinished) {
|
|
1412
|
-
return;
|
|
1413
|
-
}
|
|
1414
|
-
if (this.pendingResolve) {
|
|
1415
|
-
this.pendingResolve({ value, done: false });
|
|
1416
|
-
this.pendingResolve = null;
|
|
1417
|
-
return;
|
|
1418
|
-
}
|
|
1419
|
-
this.queue.length = 0;
|
|
1420
|
-
this.queue.push(value);
|
|
1421
|
-
}
|
|
1422
|
-
processEventBlock(block2, requestTokenRefresh) {
|
|
1423
|
-
if (!block2 || block2.startsWith(":")) {
|
|
1424
|
-
return;
|
|
1425
|
-
}
|
|
1426
|
-
let eventType;
|
|
1427
|
-
const dataLines = [];
|
|
1428
|
-
for (const line of block2.split(/\r\n|\r|\n/)) {
|
|
1429
|
-
if (line.startsWith("event: ")) {
|
|
1430
|
-
eventType = line.slice(7).trim();
|
|
1431
|
-
} else if (line.startsWith("data: ")) {
|
|
1432
|
-
dataLines.push(line.slice(6));
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
if (eventType === "token-expired") {
|
|
1436
|
-
requestTokenRefresh();
|
|
1437
|
-
throw new BillingAuthStreamError(401);
|
|
1438
|
-
}
|
|
1439
|
-
if (eventType !== "subscription" || dataLines.length === 0) {
|
|
1440
|
-
return;
|
|
1441
|
-
}
|
|
1442
|
-
try {
|
|
1443
|
-
const parsed = JSON.parse(dataLines.join("\n"));
|
|
1444
|
-
this.push(parsed);
|
|
1445
|
-
} catch {
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
};
|
|
1449
|
-
var BillingClient = class {
|
|
1450
|
-
http;
|
|
1451
|
-
options;
|
|
1452
|
-
activeUpdateStreams = /* @__PURE__ */ new Set();
|
|
1453
|
-
constructor(options) {
|
|
1454
|
-
this.options = options;
|
|
1455
|
-
this.http = createHttpTransport({
|
|
1456
|
-
url: options.billingHttpUrl,
|
|
1457
|
-
getToken: options.getToken,
|
|
1458
|
-
getLanguage: () => void 0,
|
|
1459
|
-
onError: options.onError
|
|
1460
|
-
});
|
|
1461
|
-
}
|
|
1462
|
-
/**
|
|
1463
|
-
* Terminate all active SSE streams.
|
|
1464
|
-
* Call this on logout or SDK teardown to prevent lingering connections.
|
|
1465
|
-
*/
|
|
1466
|
-
destroy() {
|
|
1467
|
-
for (const stream of Array.from(this.activeUpdateStreams)) {
|
|
1468
|
-
stream.close();
|
|
1469
|
-
}
|
|
1470
|
-
this.activeUpdateStreams.clear();
|
|
1471
|
-
}
|
|
1472
|
-
reconnectAll() {
|
|
1473
|
-
for (const stream of this.activeUpdateStreams) {
|
|
1474
|
-
stream.reconnect();
|
|
1475
|
-
}
|
|
1476
|
-
}
|
|
1477
|
-
get plans() {
|
|
1478
|
-
return {
|
|
1479
|
-
list: async () => {
|
|
1480
|
-
const result = await this.request(PlansDocument);
|
|
1481
|
-
return result.plans;
|
|
1482
|
-
},
|
|
1483
|
-
get: async (variables) => {
|
|
1484
|
-
const result = await this.request(PlanDocument, variables);
|
|
1485
|
-
return result.plan;
|
|
1486
|
-
},
|
|
1487
|
-
entitlements: async () => {
|
|
1488
|
-
const result = await this.request(EntitlementsDocument);
|
|
1489
|
-
return result.entitlements;
|
|
1490
|
-
},
|
|
1491
|
-
tierOrders: async () => {
|
|
1492
|
-
const result = await this.request(TierOrdersDocument);
|
|
1493
|
-
return result.tierOrders;
|
|
1494
|
-
}
|
|
1495
|
-
};
|
|
1496
|
-
}
|
|
1497
|
-
get subscription() {
|
|
1498
|
-
return {
|
|
1499
|
-
get: async () => {
|
|
1500
|
-
const result = await this.request(SubscriptionDocument);
|
|
1501
|
-
return result.subscription;
|
|
1502
|
-
},
|
|
1503
|
-
entitlements: async () => {
|
|
1504
|
-
const result = await this.request(SubscriptionEntitlementsDocument);
|
|
1505
|
-
return result.subscriptionEntitlements;
|
|
1506
|
-
},
|
|
1507
|
-
upgrade: async (variables) => {
|
|
1508
|
-
const result = await this.request(UpgradePlanDocument, variables);
|
|
1509
|
-
return result.upgradePlan;
|
|
1510
|
-
},
|
|
1511
|
-
prorationAmount: async (variables) => {
|
|
1512
|
-
const result = await this.request(ProrationAmountDocument, variables);
|
|
1513
|
-
return result.prorationAmount;
|
|
1514
|
-
},
|
|
1515
|
-
downgrade: async (variables) => {
|
|
1516
|
-
const result = await this.request(DowngradePlanDocument, variables);
|
|
1517
|
-
return result.downgradePlan;
|
|
1518
|
-
},
|
|
1519
|
-
changeBillingCycle: async (variables) => {
|
|
1520
|
-
const result = await this.request(ChangeBillingCycleDocument, variables);
|
|
1521
|
-
return result.changeBillingCycle;
|
|
1522
|
-
},
|
|
1523
|
-
cancel: async () => {
|
|
1524
|
-
const result = await this.request(CancelSubscriptionDocument);
|
|
1525
|
-
return result.cancelSubscription;
|
|
1526
|
-
},
|
|
1527
|
-
reactivate: async () => {
|
|
1528
|
-
const result = await this.request(ReactivateSubscriptionDocument);
|
|
1529
|
-
return result.reactivateSubscription;
|
|
1530
|
-
},
|
|
1531
|
-
releaseSchedule: async () => {
|
|
1532
|
-
const result = await this.request(ReleaseScheduleDocument);
|
|
1533
|
-
return result.releaseSchedule;
|
|
1534
|
-
},
|
|
1535
|
-
updates: () => {
|
|
1536
|
-
const stream = new BillingSubscriptionStream(this.options, (closedStream) => {
|
|
1537
|
-
this.activeUpdateStreams.delete(closedStream);
|
|
1538
|
-
});
|
|
1539
|
-
this.activeUpdateStreams.add(stream);
|
|
1540
|
-
stream.start();
|
|
1541
|
-
return stream;
|
|
1542
|
-
}
|
|
1543
|
-
};
|
|
1544
|
-
}
|
|
1545
|
-
get seats() {
|
|
1546
|
-
return {
|
|
1547
|
-
add: async (variables) => {
|
|
1548
|
-
const result = await this.request(AddSeatsDocument, variables);
|
|
1549
|
-
return result.addSeats;
|
|
1550
|
-
},
|
|
1551
|
-
remove: async (variables) => {
|
|
1552
|
-
const result = await this.request(RemoveSeatsDocument, variables);
|
|
1553
|
-
return result.removeSeats;
|
|
1554
|
-
}
|
|
1555
|
-
};
|
|
1556
|
-
}
|
|
1557
|
-
get session() {
|
|
1558
|
-
return {
|
|
1559
|
-
createSession: async (variables) => {
|
|
1560
|
-
const result = await this.request(CreateCheckoutSessionDocument, variables);
|
|
1561
|
-
return result.createCheckoutSession;
|
|
1562
|
-
},
|
|
1563
|
-
createCustomerPortalSession: async (variables) => {
|
|
1564
|
-
const result = await this.request(CreateCustomerPortalSessionDocument, variables);
|
|
1565
|
-
return result.createCustomerPortalSession;
|
|
1566
|
-
}
|
|
1567
|
-
};
|
|
1568
|
-
}
|
|
1569
|
-
get management() {
|
|
1570
|
-
return {
|
|
1571
|
-
subscription: async (variables) => {
|
|
1572
|
-
const result = await this.request(SubscriptionForManagerDocument, variables);
|
|
1573
|
-
return result.subscriptionForManager;
|
|
1574
|
-
},
|
|
1575
|
-
entitlements: async (variables) => {
|
|
1576
|
-
const result = await this.request(SubscriptionEntitlementsForManagerDocument, variables);
|
|
1577
|
-
return result.subscriptionEntitlementsForManager;
|
|
1578
|
-
},
|
|
1579
|
-
cancel: async (variables) => {
|
|
1580
|
-
const result = await this.request(CancelSubscriptionForManagerDocument, variables);
|
|
1581
|
-
return result.cancelSubscriptionForManager;
|
|
1582
|
-
},
|
|
1583
|
-
reactivate: async (variables) => {
|
|
1584
|
-
const result = await this.request(ReactivateSubscriptionForManagerDocument, variables);
|
|
1585
|
-
return result.reactivateSubscriptionForManager;
|
|
1586
|
-
},
|
|
1587
|
-
createCustomer: async (variables) => {
|
|
1588
|
-
const result = await this.request(CreateCustomerDocument, variables);
|
|
1589
|
-
return result.createCustomer;
|
|
1590
|
-
}
|
|
1591
|
-
};
|
|
1592
|
-
}
|
|
1593
|
-
request(document, variables) {
|
|
1594
|
-
return this.http.request(document, variables);
|
|
1595
|
-
}
|
|
1596
|
-
};
|
|
1597
|
-
|
|
1598
|
-
export { BillingClient, EntitlementTier, Kind, SubscriptionCycle, SubscriptionProvider, createHttpTransport, print, refreshTokenSingleFlight };
|
|
1599
|
-
//# sourceMappingURL=chunk-WX7EFPHT.js.map
|
|
1600
|
-
//# sourceMappingURL=chunk-WX7EFPHT.js.map
|