@dvina/sdk 3.3.124
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/LICENSE +21 -0
- package/README.md +449 -0
- package/dist/_generated_documents-DF34ZUJ3.js +4 -0
- package/dist/_generated_documents-DF34ZUJ3.js.map +1 -0
- package/dist/_generated_documents-W4RHWJ4B.cjs +2041 -0
- package/dist/_generated_documents-W4RHWJ4B.cjs.map +1 -0
- package/dist/adapters/angular/index.cjs +163 -0
- package/dist/adapters/angular/index.cjs.map +1 -0
- package/dist/adapters/angular/index.d.cts +254 -0
- package/dist/adapters/angular/index.d.ts +254 -0
- package/dist/adapters/angular/index.js +159 -0
- package/dist/adapters/angular/index.js.map +1 -0
- package/dist/adapters/react/index.cjs +51 -0
- package/dist/adapters/react/index.cjs.map +1 -0
- package/dist/adapters/react/index.d.cts +62 -0
- package/dist/adapters/react/index.d.ts +62 -0
- package/dist/adapters/react/index.js +49 -0
- package/dist/adapters/react/index.js.map +1 -0
- package/dist/billing/index.cjs +26 -0
- package/dist/billing/index.cjs.map +1 -0
- package/dist/billing/index.d.cts +338 -0
- package/dist/billing/index.d.ts +338 -0
- package/dist/billing/index.js +5 -0
- package/dist/billing/index.js.map +1 -0
- package/dist/chunk-4QKWHQT2.cjs +104 -0
- package/dist/chunk-4QKWHQT2.cjs.map +1 -0
- package/dist/chunk-5WRI5ZAA.js +29 -0
- package/dist/chunk-5WRI5ZAA.js.map +1 -0
- package/dist/chunk-7JUBGIQ2.js +1008 -0
- package/dist/chunk-7JUBGIQ2.js.map +1 -0
- package/dist/chunk-7XBJ77RJ.js +103 -0
- package/dist/chunk-7XBJ77RJ.js.map +1 -0
- package/dist/chunk-DHUFVGJR.cjs +20389 -0
- package/dist/chunk-DHUFVGJR.cjs.map +1 -0
- package/dist/chunk-DZUJEN5N.cjs +32 -0
- package/dist/chunk-DZUJEN5N.cjs.map +1 -0
- package/dist/chunk-GDK2HJTF.cjs +1346 -0
- package/dist/chunk-GDK2HJTF.cjs.map +1 -0
- package/dist/chunk-KG3GNTYI.js +1339 -0
- package/dist/chunk-KG3GNTYI.js.map +1 -0
- package/dist/chunk-KV5SP7RP.cjs +114 -0
- package/dist/chunk-KV5SP7RP.cjs.map +1 -0
- package/dist/chunk-NPIKZKLU.cjs +27 -0
- package/dist/chunk-NPIKZKLU.cjs.map +1 -0
- package/dist/chunk-OAAZZUYL.cjs +1517 -0
- package/dist/chunk-OAAZZUYL.cjs.map +1 -0
- package/dist/chunk-P4BYTXZ7.js +98 -0
- package/dist/chunk-P4BYTXZ7.js.map +1 -0
- package/dist/chunk-PDM2KR7T.js +392 -0
- package/dist/chunk-PDM2KR7T.js.map +1 -0
- package/dist/chunk-QOZI2HY5.js +24 -0
- package/dist/chunk-QOZI2HY5.js.map +1 -0
- package/dist/chunk-RFBLNKW6.js +20035 -0
- package/dist/chunk-RFBLNKW6.js.map +1 -0
- package/dist/chunk-UELAE75E.cjs +408 -0
- package/dist/chunk-UELAE75E.cjs.map +1 -0
- package/dist/client-9Rwj21T9.d.cts +77 -0
- package/dist/client-Bskq7sc_.d.ts +77 -0
- package/dist/client-CLhQragb.d.cts +446 -0
- package/dist/client-CLhQragb.d.ts +446 -0
- package/dist/error-CsVoUTY8.d.cts +95 -0
- package/dist/error-CsVoUTY8.d.ts +95 -0
- package/dist/index-BrGSfyXq.d.cts +79 -0
- package/dist/index-zPcVLagO.d.ts +79 -0
- package/dist/index.cjs +1675 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +9943 -0
- package/dist/index.d.ts +9943 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/inference/index.cjs +70 -0
- package/dist/inference/index.cjs.map +1 -0
- package/dist/inference/index.d.cts +80 -0
- package/dist/inference/index.d.ts +80 -0
- package/dist/inference/index.js +5 -0
- package/dist/inference/index.js.map +1 -0
- package/dist/pagination/index.cjs +34 -0
- package/dist/pagination/index.cjs.map +1 -0
- package/dist/pagination/index.d.cts +6 -0
- package/dist/pagination/index.d.ts +6 -0
- package/dist/pagination/index.js +5 -0
- package/dist/pagination/index.js.map +1 -0
- package/dist/sync-engine-DVKQO-1-.d.cts +423 -0
- package/dist/sync-engine-cLwTqdjv.d.ts +423 -0
- package/dist/types-2RotD0Ab.d.cts +102 -0
- package/dist/types-2RotD0Ab.d.ts +102 -0
- package/package.json +143 -0
|
@@ -0,0 +1,1339 @@
|
|
|
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/http.ts
|
|
854
|
+
var printCache = /* @__PURE__ */ new WeakMap();
|
|
855
|
+
function printDocument(document) {
|
|
856
|
+
let cached = printCache.get(document);
|
|
857
|
+
if (!cached) {
|
|
858
|
+
cached = print(document);
|
|
859
|
+
printCache.set(document, cached);
|
|
860
|
+
}
|
|
861
|
+
return cached;
|
|
862
|
+
}
|
|
863
|
+
var NON_AUTH_CODES = /* @__PURE__ */ new Set([
|
|
864
|
+
GRAPHQL_ERROR_CODES.SESSION_TOKEN_LIMIT_REACHED,
|
|
865
|
+
GRAPHQL_ERROR_CODES.STORAGE_LIMIT_REACHED,
|
|
866
|
+
GRAPHQL_ERROR_CODES.DEEP_ANALYSIS_LIMIT_EXCEEDED,
|
|
867
|
+
GRAPHQL_ERROR_CODES.PLAN_DETAIL_RESTRICTION,
|
|
868
|
+
GRAPHQL_ERROR_CODES.RESOURCE_NOT_FOUND
|
|
869
|
+
]);
|
|
870
|
+
function isAuthError(errors, status) {
|
|
871
|
+
if (errors) {
|
|
872
|
+
for (const err of errors) {
|
|
873
|
+
const rawCode = err.extensions?.["code"];
|
|
874
|
+
if (rawCode === void 0 || rawCode === null) continue;
|
|
875
|
+
if (rawCode === 4401 || rawCode === "4401") return true;
|
|
876
|
+
const code = String(rawCode).toUpperCase();
|
|
877
|
+
if (NON_AUTH_CODES.has(code)) return false;
|
|
878
|
+
if (code === "UNAUTHORIZED" || code === "UNAUTHENTICATED" || err.message === "Unauthorized") {
|
|
879
|
+
return true;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
return false;
|
|
884
|
+
}
|
|
885
|
+
async function doFetch(options, document, variables) {
|
|
886
|
+
const token = await options.getToken();
|
|
887
|
+
const lang = options.getLanguage();
|
|
888
|
+
const headers = {
|
|
889
|
+
"Content-Type": "application/json",
|
|
890
|
+
Authorization: `Bearer ${token}`
|
|
891
|
+
};
|
|
892
|
+
if (lang) {
|
|
893
|
+
headers["x-preferred-language"] = lang;
|
|
894
|
+
}
|
|
895
|
+
const body = JSON.stringify({
|
|
896
|
+
query: printDocument(document),
|
|
897
|
+
variables
|
|
898
|
+
});
|
|
899
|
+
const response = await fetch(options.url, {
|
|
900
|
+
method: "POST",
|
|
901
|
+
headers,
|
|
902
|
+
body
|
|
903
|
+
});
|
|
904
|
+
if (!response.ok) {
|
|
905
|
+
if (response.status === 401 || response.status === 403) {
|
|
906
|
+
throw new DvinaAuthenticationError(`Authentication failed with status ${response.status}`, token);
|
|
907
|
+
}
|
|
908
|
+
throw new DvinaNetworkError(`HTTP ${response.status}: ${response.statusText}`, response.status);
|
|
909
|
+
}
|
|
910
|
+
return { response: await response.json(), usedToken: token };
|
|
911
|
+
}
|
|
912
|
+
var MAX_RETRIES = 4;
|
|
913
|
+
var RETRY_DELAY_MS = 1e3;
|
|
914
|
+
function createHttpTransport(options) {
|
|
915
|
+
const refreshState = {
|
|
916
|
+
isRefreshing: false,
|
|
917
|
+
pendingRequests: []
|
|
918
|
+
};
|
|
919
|
+
async function requestWithRetry(document, variables, attempt = 0) {
|
|
920
|
+
let fetchResult;
|
|
921
|
+
try {
|
|
922
|
+
fetchResult = await doFetch(options, document, variables);
|
|
923
|
+
} catch (error) {
|
|
924
|
+
if (error instanceof DvinaAuthenticationError) {
|
|
925
|
+
return handleAuthRefresh(document, variables, refreshState, options, error.failedToken);
|
|
926
|
+
}
|
|
927
|
+
if (error instanceof DvinaNetworkError && error.status === 0 && attempt < MAX_RETRIES) {
|
|
928
|
+
await sleep(RETRY_DELAY_MS * (attempt + 1));
|
|
929
|
+
return requestWithRetry(document, variables, attempt + 1);
|
|
930
|
+
}
|
|
931
|
+
if (error instanceof DvinaError) options.onError?.(error);
|
|
932
|
+
throw error;
|
|
933
|
+
}
|
|
934
|
+
const { response: result, usedToken } = fetchResult;
|
|
935
|
+
if (isAuthError(result.errors)) {
|
|
936
|
+
return handleAuthRefresh(document, variables, refreshState, options, usedToken);
|
|
937
|
+
}
|
|
938
|
+
if (result.errors?.length && !result.data) {
|
|
939
|
+
const error = createGraphQLError(result.errors, printDocument(document), variables);
|
|
940
|
+
options.onError?.(error);
|
|
941
|
+
throw error;
|
|
942
|
+
}
|
|
943
|
+
if (!result.data) {
|
|
944
|
+
const error = createGraphQLError(
|
|
945
|
+
[{ message: "No data returned from server" }],
|
|
946
|
+
printDocument(document),
|
|
947
|
+
variables
|
|
948
|
+
);
|
|
949
|
+
options.onError?.(error);
|
|
950
|
+
throw error;
|
|
951
|
+
}
|
|
952
|
+
return result.data;
|
|
953
|
+
}
|
|
954
|
+
return {
|
|
955
|
+
request: (document, variables) => requestWithRetry(document, variables)
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
async function handleAuthRefresh(document, variables, refreshState, options, failedToken) {
|
|
959
|
+
if (!refreshState.isRefreshing) {
|
|
960
|
+
refreshState.isRefreshing = true;
|
|
961
|
+
try {
|
|
962
|
+
const newToken = await options.getToken({ forceRefresh: true });
|
|
963
|
+
if (failedToken && newToken === failedToken) {
|
|
964
|
+
throw new DvinaAuthenticationError("Token refresh did not produce a new token");
|
|
965
|
+
}
|
|
966
|
+
refreshState.pendingRequests.forEach((req) => req.resolve());
|
|
967
|
+
refreshState.pendingRequests = [];
|
|
968
|
+
refreshState.isRefreshing = false;
|
|
969
|
+
} catch {
|
|
970
|
+
const error = new DvinaAuthenticationError("Token refresh failed");
|
|
971
|
+
options.onError?.(error);
|
|
972
|
+
refreshState.pendingRequests.forEach((req) => req.reject(error));
|
|
973
|
+
refreshState.pendingRequests = [];
|
|
974
|
+
refreshState.isRefreshing = false;
|
|
975
|
+
throw error;
|
|
976
|
+
}
|
|
977
|
+
return retryAfterRefresh(options, document, variables);
|
|
978
|
+
}
|
|
979
|
+
await new Promise((resolve, reject) => {
|
|
980
|
+
refreshState.pendingRequests.push({ resolve, reject });
|
|
981
|
+
});
|
|
982
|
+
return retryAfterRefresh(options, document, variables);
|
|
983
|
+
}
|
|
984
|
+
async function retryAfterRefresh(options, document, variables) {
|
|
985
|
+
const { response: result } = await doFetch(options, document, variables);
|
|
986
|
+
if (isAuthError(result.errors)) {
|
|
987
|
+
const error = new DvinaAuthenticationError("Authentication failed after token refresh");
|
|
988
|
+
options.onError?.(error);
|
|
989
|
+
throw error;
|
|
990
|
+
}
|
|
991
|
+
if (result.errors?.length && !result.data) {
|
|
992
|
+
const error = createGraphQLError(result.errors, printDocument(document), variables);
|
|
993
|
+
options.onError?.(error);
|
|
994
|
+
throw error;
|
|
995
|
+
}
|
|
996
|
+
return result.data;
|
|
997
|
+
}
|
|
998
|
+
function sleep(ms) {
|
|
999
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
// src/billing/client.ts
|
|
1003
|
+
var INITIAL_RECONNECT_DELAY_MS = 1e3;
|
|
1004
|
+
var MAX_RECONNECT_DELAY_MS = 3e4;
|
|
1005
|
+
var RECONNECT_BACKOFF_MULTIPLIER = 2;
|
|
1006
|
+
var MAX_CONSECUTIVE_AUTH_FAILURES = 3;
|
|
1007
|
+
var BillingClient = class {
|
|
1008
|
+
http;
|
|
1009
|
+
options;
|
|
1010
|
+
activeAbortControllers = /* @__PURE__ */ new Set();
|
|
1011
|
+
constructor(options) {
|
|
1012
|
+
this.options = options;
|
|
1013
|
+
this.http = createHttpTransport({
|
|
1014
|
+
url: options.billingHttpUrl,
|
|
1015
|
+
getToken: options.getToken,
|
|
1016
|
+
getLanguage: () => void 0,
|
|
1017
|
+
onError: options.onError
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* Terminate all active SSE streams.
|
|
1022
|
+
* Call this on logout or SDK teardown to prevent lingering connections.
|
|
1023
|
+
*/
|
|
1024
|
+
destroy() {
|
|
1025
|
+
for (const controller of this.activeAbortControllers) {
|
|
1026
|
+
controller.abort();
|
|
1027
|
+
}
|
|
1028
|
+
this.activeAbortControllers.clear();
|
|
1029
|
+
}
|
|
1030
|
+
// ─── Plans ───────────────────────────────────────────────────────────────
|
|
1031
|
+
get plans() {
|
|
1032
|
+
return {
|
|
1033
|
+
list: async () => {
|
|
1034
|
+
const result = await this.request(PlansDocument);
|
|
1035
|
+
return result.plans;
|
|
1036
|
+
},
|
|
1037
|
+
get: async (variables) => {
|
|
1038
|
+
const result = await this.request(PlanDocument, variables);
|
|
1039
|
+
return result.plan;
|
|
1040
|
+
},
|
|
1041
|
+
entitlements: async () => {
|
|
1042
|
+
const result = await this.request(EntitlementsDocument);
|
|
1043
|
+
return result.entitlements;
|
|
1044
|
+
},
|
|
1045
|
+
tierOrders: async () => {
|
|
1046
|
+
const result = await this.request(TierOrdersDocument);
|
|
1047
|
+
return result.tierOrders;
|
|
1048
|
+
}
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
// ─── Subscription ────────────────────────────────────────────────────────
|
|
1052
|
+
get subscription() {
|
|
1053
|
+
return {
|
|
1054
|
+
get: async () => {
|
|
1055
|
+
const result = await this.request(SubscriptionDocument);
|
|
1056
|
+
return result.subscription;
|
|
1057
|
+
},
|
|
1058
|
+
entitlements: async () => {
|
|
1059
|
+
const result = await this.request(SubscriptionEntitlementsDocument);
|
|
1060
|
+
return result.subscriptionEntitlements;
|
|
1061
|
+
},
|
|
1062
|
+
upgrade: async (variables) => {
|
|
1063
|
+
const result = await this.request(UpgradePlanDocument, variables);
|
|
1064
|
+
return result.upgradePlan;
|
|
1065
|
+
},
|
|
1066
|
+
prorationAmount: async (variables) => {
|
|
1067
|
+
const result = await this.request(ProrationAmountDocument, variables);
|
|
1068
|
+
return result.prorationAmount;
|
|
1069
|
+
},
|
|
1070
|
+
downgrade: async (variables) => {
|
|
1071
|
+
const result = await this.request(DowngradePlanDocument, variables);
|
|
1072
|
+
return result.downgradePlan;
|
|
1073
|
+
},
|
|
1074
|
+
changeBillingCycle: async (variables) => {
|
|
1075
|
+
const result = await this.request(ChangeBillingCycleDocument, variables);
|
|
1076
|
+
return result.changeBillingCycle;
|
|
1077
|
+
},
|
|
1078
|
+
cancel: async () => {
|
|
1079
|
+
const result = await this.request(CancelSubscriptionDocument);
|
|
1080
|
+
return result.cancelSubscription;
|
|
1081
|
+
},
|
|
1082
|
+
reactivate: async () => {
|
|
1083
|
+
const result = await this.request(ReactivateSubscriptionDocument);
|
|
1084
|
+
return result.reactivateSubscription;
|
|
1085
|
+
},
|
|
1086
|
+
releaseSchedule: async () => {
|
|
1087
|
+
const result = await this.request(ReleaseScheduleDocument);
|
|
1088
|
+
return result.releaseSchedule;
|
|
1089
|
+
},
|
|
1090
|
+
/**
|
|
1091
|
+
* Subscribe to real-time subscription updates via SSE.
|
|
1092
|
+
* Returns an AsyncIterable that yields WorkspaceSubscription snapshots.
|
|
1093
|
+
* Automatically reconnects with exponential backoff and token refresh on auth errors.
|
|
1094
|
+
*/
|
|
1095
|
+
updates: () => {
|
|
1096
|
+
return this.createSseStream();
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1100
|
+
// ─── Seats ───────────────────────────────────────────────────────────────
|
|
1101
|
+
get seats() {
|
|
1102
|
+
return {
|
|
1103
|
+
add: async (variables) => {
|
|
1104
|
+
const result = await this.request(AddSeatsDocument, variables);
|
|
1105
|
+
return result.addSeats;
|
|
1106
|
+
},
|
|
1107
|
+
remove: async (variables) => {
|
|
1108
|
+
const result = await this.request(RemoveSeatsDocument, variables);
|
|
1109
|
+
return result.removeSeats;
|
|
1110
|
+
}
|
|
1111
|
+
};
|
|
1112
|
+
}
|
|
1113
|
+
// ─── Sessions ────────────────────────────────────────────────────────────
|
|
1114
|
+
get session() {
|
|
1115
|
+
return {
|
|
1116
|
+
createSession: async (variables) => {
|
|
1117
|
+
const result = await this.request(CreateCheckoutSessionDocument, variables);
|
|
1118
|
+
return result.createCheckoutSession;
|
|
1119
|
+
},
|
|
1120
|
+
createCustomerPortalSession: async (variables) => {
|
|
1121
|
+
const result = await this.request(CreateCustomerPortalSessionDocument, variables);
|
|
1122
|
+
return result.createCustomerPortalSession;
|
|
1123
|
+
}
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1126
|
+
// ─── Management ──────────────────────────────────────────────────────────
|
|
1127
|
+
get management() {
|
|
1128
|
+
return {
|
|
1129
|
+
subscription: async (variables) => {
|
|
1130
|
+
const result = await this.request(SubscriptionForManagerDocument, variables);
|
|
1131
|
+
return result.subscriptionForManager;
|
|
1132
|
+
},
|
|
1133
|
+
entitlements: async (variables) => {
|
|
1134
|
+
const result = await this.request(SubscriptionEntitlementsForManagerDocument, variables);
|
|
1135
|
+
return result.subscriptionEntitlementsForManager;
|
|
1136
|
+
},
|
|
1137
|
+
cancel: async (variables) => {
|
|
1138
|
+
const result = await this.request(CancelSubscriptionForManagerDocument, variables);
|
|
1139
|
+
return result.cancelSubscriptionForManager;
|
|
1140
|
+
},
|
|
1141
|
+
reactivate: async (variables) => {
|
|
1142
|
+
const result = await this.request(ReactivateSubscriptionForManagerDocument, variables);
|
|
1143
|
+
return result.reactivateSubscriptionForManager;
|
|
1144
|
+
},
|
|
1145
|
+
createCustomer: async (variables) => {
|
|
1146
|
+
const result = await this.request(CreateCustomerDocument, variables);
|
|
1147
|
+
return result.createCustomer;
|
|
1148
|
+
}
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
// ─── Private ─────────────────────────────────────────────────────────────
|
|
1152
|
+
request(document, variables) {
|
|
1153
|
+
return this.http.request(document, variables);
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* Create an SSE stream that connects to the billing SSE endpoint.
|
|
1157
|
+
* Reconnects automatically with exponential backoff.
|
|
1158
|
+
* On 401/403, refreshes the token and retries with a short delay.
|
|
1159
|
+
*/
|
|
1160
|
+
createSseStream() {
|
|
1161
|
+
const options = this.options;
|
|
1162
|
+
const activeAbortControllers = this.activeAbortControllers;
|
|
1163
|
+
return {
|
|
1164
|
+
[Symbol.asyncIterator]() {
|
|
1165
|
+
const queue = [];
|
|
1166
|
+
let resolve = null;
|
|
1167
|
+
let done = false;
|
|
1168
|
+
let abortController;
|
|
1169
|
+
let reconnectTimer;
|
|
1170
|
+
let reconnectDelay = INITIAL_RECONNECT_DELAY_MS;
|
|
1171
|
+
let shouldReconnect = true;
|
|
1172
|
+
let needsForceRefresh = false;
|
|
1173
|
+
let consecutiveAuthFailures = 0;
|
|
1174
|
+
function push(value) {
|
|
1175
|
+
if (resolve) {
|
|
1176
|
+
resolve({ value, done: false });
|
|
1177
|
+
resolve = null;
|
|
1178
|
+
} else {
|
|
1179
|
+
queue.length = 0;
|
|
1180
|
+
queue.push(value);
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
async function connect() {
|
|
1184
|
+
if (!shouldReconnect) return;
|
|
1185
|
+
if (abortController) {
|
|
1186
|
+
activeAbortControllers.delete(abortController);
|
|
1187
|
+
}
|
|
1188
|
+
abortController = new AbortController();
|
|
1189
|
+
activeAbortControllers.add(abortController);
|
|
1190
|
+
try {
|
|
1191
|
+
const forceRefresh = needsForceRefresh;
|
|
1192
|
+
needsForceRefresh = false;
|
|
1193
|
+
const token = await options.getToken(forceRefresh ? { forceRefresh: true } : void 0);
|
|
1194
|
+
const response = await fetch(options.billingSseUrl, {
|
|
1195
|
+
method: "GET",
|
|
1196
|
+
headers: {
|
|
1197
|
+
Authorization: `Bearer ${token}`,
|
|
1198
|
+
Accept: "text/event-stream",
|
|
1199
|
+
"Cache-Control": "no-cache"
|
|
1200
|
+
},
|
|
1201
|
+
signal: abortController.signal
|
|
1202
|
+
});
|
|
1203
|
+
if (!response.ok) {
|
|
1204
|
+
if (response.status === 401 || response.status === 403) {
|
|
1205
|
+
consecutiveAuthFailures++;
|
|
1206
|
+
if (consecutiveAuthFailures >= MAX_CONSECUTIVE_AUTH_FAILURES) {
|
|
1207
|
+
done = true;
|
|
1208
|
+
shouldReconnect = false;
|
|
1209
|
+
options.onError?.(
|
|
1210
|
+
new DvinaAuthenticationError(
|
|
1211
|
+
"Billing SSE stream authentication failed permanently"
|
|
1212
|
+
)
|
|
1213
|
+
);
|
|
1214
|
+
if (resolve) {
|
|
1215
|
+
resolve({ value: void 0, done: true });
|
|
1216
|
+
resolve = null;
|
|
1217
|
+
}
|
|
1218
|
+
return;
|
|
1219
|
+
}
|
|
1220
|
+
needsForceRefresh = true;
|
|
1221
|
+
scheduleReconnect(INITIAL_RECONNECT_DELAY_MS);
|
|
1222
|
+
return;
|
|
1223
|
+
}
|
|
1224
|
+
throw new Error(`Billing SSE failed: ${response.status} ${response.statusText}`);
|
|
1225
|
+
}
|
|
1226
|
+
if (!response.body) {
|
|
1227
|
+
throw new Error("Billing SSE response has no body");
|
|
1228
|
+
}
|
|
1229
|
+
consecutiveAuthFailures = 0;
|
|
1230
|
+
reconnectDelay = INITIAL_RECONNECT_DELAY_MS;
|
|
1231
|
+
await parseSseStream(response.body, abortController.signal);
|
|
1232
|
+
} catch (err) {
|
|
1233
|
+
if (err.name === "AbortError") return;
|
|
1234
|
+
if (shouldReconnect) {
|
|
1235
|
+
scheduleReconnect(reconnectDelay);
|
|
1236
|
+
reconnectDelay = Math.min(
|
|
1237
|
+
reconnectDelay * RECONNECT_BACKOFF_MULTIPLIER,
|
|
1238
|
+
MAX_RECONNECT_DELAY_MS
|
|
1239
|
+
);
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
async function parseSseStream(body, signal) {
|
|
1244
|
+
const reader = body.getReader();
|
|
1245
|
+
const decoder = new TextDecoder();
|
|
1246
|
+
let buffer = "";
|
|
1247
|
+
try {
|
|
1248
|
+
while (!signal.aborted && shouldReconnect) {
|
|
1249
|
+
const { done: streamDone, value } = await reader.read();
|
|
1250
|
+
if (streamDone) break;
|
|
1251
|
+
buffer += decoder.decode(value, { stream: true });
|
|
1252
|
+
const parts = buffer.split(/(?:\r\n|\r|\n){2}/);
|
|
1253
|
+
buffer = parts.pop() ?? "";
|
|
1254
|
+
for (const part of parts) {
|
|
1255
|
+
processEventBlock(part.trim());
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
} finally {
|
|
1259
|
+
reader.releaseLock();
|
|
1260
|
+
}
|
|
1261
|
+
if (shouldReconnect) {
|
|
1262
|
+
scheduleReconnect(reconnectDelay);
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
function processEventBlock(block2) {
|
|
1266
|
+
if (!block2 || block2.startsWith(":")) return;
|
|
1267
|
+
let eventType;
|
|
1268
|
+
let eventData;
|
|
1269
|
+
for (const line of block2.split(/\r\n|\r|\n/)) {
|
|
1270
|
+
if (line.startsWith("event: ")) {
|
|
1271
|
+
eventType = line.slice(7).trim();
|
|
1272
|
+
} else if (line.startsWith("data: ")) {
|
|
1273
|
+
eventData = line.slice(6);
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
if (eventType === "token-expired") {
|
|
1277
|
+
needsForceRefresh = true;
|
|
1278
|
+
return;
|
|
1279
|
+
}
|
|
1280
|
+
if (eventType === "subscription" && eventData) {
|
|
1281
|
+
try {
|
|
1282
|
+
const parsed = JSON.parse(eventData);
|
|
1283
|
+
push(parsed);
|
|
1284
|
+
} catch {
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
function scheduleReconnect(delay) {
|
|
1289
|
+
if (!shouldReconnect) return;
|
|
1290
|
+
reconnectTimer = setTimeout(() => {
|
|
1291
|
+
connect();
|
|
1292
|
+
}, delay);
|
|
1293
|
+
}
|
|
1294
|
+
connect();
|
|
1295
|
+
return {
|
|
1296
|
+
next() {
|
|
1297
|
+
if (queue.length > 0) {
|
|
1298
|
+
return Promise.resolve({ value: queue.shift(), done: false });
|
|
1299
|
+
}
|
|
1300
|
+
if (done) {
|
|
1301
|
+
return Promise.resolve({
|
|
1302
|
+
value: void 0,
|
|
1303
|
+
done: true
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
return new Promise((r) => {
|
|
1307
|
+
resolve = r;
|
|
1308
|
+
});
|
|
1309
|
+
},
|
|
1310
|
+
return() {
|
|
1311
|
+
shouldReconnect = false;
|
|
1312
|
+
done = true;
|
|
1313
|
+
if (reconnectTimer) {
|
|
1314
|
+
clearTimeout(reconnectTimer);
|
|
1315
|
+
reconnectTimer = void 0;
|
|
1316
|
+
}
|
|
1317
|
+
if (abortController) {
|
|
1318
|
+
activeAbortControllers.delete(abortController);
|
|
1319
|
+
abortController.abort();
|
|
1320
|
+
abortController = void 0;
|
|
1321
|
+
}
|
|
1322
|
+
if (resolve) {
|
|
1323
|
+
resolve({ value: void 0, done: true });
|
|
1324
|
+
resolve = null;
|
|
1325
|
+
}
|
|
1326
|
+
return Promise.resolve({ value: void 0, done: true });
|
|
1327
|
+
},
|
|
1328
|
+
[Symbol.asyncIterator]() {
|
|
1329
|
+
return this;
|
|
1330
|
+
}
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
};
|
|
1334
|
+
}
|
|
1335
|
+
};
|
|
1336
|
+
|
|
1337
|
+
export { BillingClient, EntitlementTier, Kind, SubscriptionCycle, SubscriptionProvider, createHttpTransport, print };
|
|
1338
|
+
//# sourceMappingURL=chunk-KG3GNTYI.js.map
|
|
1339
|
+
//# sourceMappingURL=chunk-KG3GNTYI.js.map
|