@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.
Files changed (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +449 -0
  3. package/dist/_generated_documents-DF34ZUJ3.js +4 -0
  4. package/dist/_generated_documents-DF34ZUJ3.js.map +1 -0
  5. package/dist/_generated_documents-W4RHWJ4B.cjs +2041 -0
  6. package/dist/_generated_documents-W4RHWJ4B.cjs.map +1 -0
  7. package/dist/adapters/angular/index.cjs +163 -0
  8. package/dist/adapters/angular/index.cjs.map +1 -0
  9. package/dist/adapters/angular/index.d.cts +254 -0
  10. package/dist/adapters/angular/index.d.ts +254 -0
  11. package/dist/adapters/angular/index.js +159 -0
  12. package/dist/adapters/angular/index.js.map +1 -0
  13. package/dist/adapters/react/index.cjs +51 -0
  14. package/dist/adapters/react/index.cjs.map +1 -0
  15. package/dist/adapters/react/index.d.cts +62 -0
  16. package/dist/adapters/react/index.d.ts +62 -0
  17. package/dist/adapters/react/index.js +49 -0
  18. package/dist/adapters/react/index.js.map +1 -0
  19. package/dist/billing/index.cjs +26 -0
  20. package/dist/billing/index.cjs.map +1 -0
  21. package/dist/billing/index.d.cts +338 -0
  22. package/dist/billing/index.d.ts +338 -0
  23. package/dist/billing/index.js +5 -0
  24. package/dist/billing/index.js.map +1 -0
  25. package/dist/chunk-4QKWHQT2.cjs +104 -0
  26. package/dist/chunk-4QKWHQT2.cjs.map +1 -0
  27. package/dist/chunk-5WRI5ZAA.js +29 -0
  28. package/dist/chunk-5WRI5ZAA.js.map +1 -0
  29. package/dist/chunk-7JUBGIQ2.js +1008 -0
  30. package/dist/chunk-7JUBGIQ2.js.map +1 -0
  31. package/dist/chunk-7XBJ77RJ.js +103 -0
  32. package/dist/chunk-7XBJ77RJ.js.map +1 -0
  33. package/dist/chunk-DHUFVGJR.cjs +20389 -0
  34. package/dist/chunk-DHUFVGJR.cjs.map +1 -0
  35. package/dist/chunk-DZUJEN5N.cjs +32 -0
  36. package/dist/chunk-DZUJEN5N.cjs.map +1 -0
  37. package/dist/chunk-GDK2HJTF.cjs +1346 -0
  38. package/dist/chunk-GDK2HJTF.cjs.map +1 -0
  39. package/dist/chunk-KG3GNTYI.js +1339 -0
  40. package/dist/chunk-KG3GNTYI.js.map +1 -0
  41. package/dist/chunk-KV5SP7RP.cjs +114 -0
  42. package/dist/chunk-KV5SP7RP.cjs.map +1 -0
  43. package/dist/chunk-NPIKZKLU.cjs +27 -0
  44. package/dist/chunk-NPIKZKLU.cjs.map +1 -0
  45. package/dist/chunk-OAAZZUYL.cjs +1517 -0
  46. package/dist/chunk-OAAZZUYL.cjs.map +1 -0
  47. package/dist/chunk-P4BYTXZ7.js +98 -0
  48. package/dist/chunk-P4BYTXZ7.js.map +1 -0
  49. package/dist/chunk-PDM2KR7T.js +392 -0
  50. package/dist/chunk-PDM2KR7T.js.map +1 -0
  51. package/dist/chunk-QOZI2HY5.js +24 -0
  52. package/dist/chunk-QOZI2HY5.js.map +1 -0
  53. package/dist/chunk-RFBLNKW6.js +20035 -0
  54. package/dist/chunk-RFBLNKW6.js.map +1 -0
  55. package/dist/chunk-UELAE75E.cjs +408 -0
  56. package/dist/chunk-UELAE75E.cjs.map +1 -0
  57. package/dist/client-9Rwj21T9.d.cts +77 -0
  58. package/dist/client-Bskq7sc_.d.ts +77 -0
  59. package/dist/client-CLhQragb.d.cts +446 -0
  60. package/dist/client-CLhQragb.d.ts +446 -0
  61. package/dist/error-CsVoUTY8.d.cts +95 -0
  62. package/dist/error-CsVoUTY8.d.ts +95 -0
  63. package/dist/index-BrGSfyXq.d.cts +79 -0
  64. package/dist/index-zPcVLagO.d.ts +79 -0
  65. package/dist/index.cjs +1675 -0
  66. package/dist/index.cjs.map +1 -0
  67. package/dist/index.d.cts +9943 -0
  68. package/dist/index.d.ts +9943 -0
  69. package/dist/index.js +10 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/inference/index.cjs +70 -0
  72. package/dist/inference/index.cjs.map +1 -0
  73. package/dist/inference/index.d.cts +80 -0
  74. package/dist/inference/index.d.ts +80 -0
  75. package/dist/inference/index.js +5 -0
  76. package/dist/inference/index.js.map +1 -0
  77. package/dist/pagination/index.cjs +34 -0
  78. package/dist/pagination/index.cjs.map +1 -0
  79. package/dist/pagination/index.d.cts +6 -0
  80. package/dist/pagination/index.d.ts +6 -0
  81. package/dist/pagination/index.js +5 -0
  82. package/dist/pagination/index.js.map +1 -0
  83. package/dist/sync-engine-DVKQO-1-.d.cts +423 -0
  84. package/dist/sync-engine-cLwTqdjv.d.ts +423 -0
  85. package/dist/types-2RotD0Ab.d.cts +102 -0
  86. package/dist/types-2RotD0Ab.d.ts +102 -0
  87. package/package.json +143 -0
@@ -0,0 +1,1346 @@
1
+ 'use strict';
2
+
3
+ var chunkKV5SP7RP_cjs = require('./chunk-KV5SP7RP.cjs');
4
+
5
+ // src/billing/_generated.ts
6
+ var EntitlementTier = /* @__PURE__ */ ((EntitlementTier2) => {
7
+ EntitlementTier2["Enterprise"] = "enterprise";
8
+ EntitlementTier2["Free"] = "free";
9
+ EntitlementTier2["Max"] = "max";
10
+ EntitlementTier2["Plus"] = "plus";
11
+ EntitlementTier2["Pro"] = "pro";
12
+ return EntitlementTier2;
13
+ })(EntitlementTier || {});
14
+ var SubscriptionCycle = /* @__PURE__ */ ((SubscriptionCycle2) => {
15
+ SubscriptionCycle2["Daily"] = "DAILY";
16
+ SubscriptionCycle2["Monthly"] = "MONTHLY";
17
+ SubscriptionCycle2["Weekly"] = "WEEKLY";
18
+ SubscriptionCycle2["Yearly"] = "YEARLY";
19
+ return SubscriptionCycle2;
20
+ })(SubscriptionCycle || {});
21
+ var SubscriptionProvider = /* @__PURE__ */ ((SubscriptionProvider2) => {
22
+ SubscriptionProvider2["Revcat"] = "REVCAT";
23
+ SubscriptionProvider2["Stripe"] = "STRIPE";
24
+ return SubscriptionProvider2;
25
+ })(SubscriptionProvider || {});
26
+ 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" } }] } }] };
27
+ 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" } }] } }] };
28
+ 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" } }] } }] };
29
+ 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" } }] } }] };
30
+ 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" } }] } }] } }] } }] };
31
+ 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" } }] } }] } }] } }] };
32
+ 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" } }] } }] } }] };
33
+ 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" } }] } }] } }] };
34
+ 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" } } }] }] } }] };
35
+ 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" } } }] }] } }] };
36
+ 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" } } }] }] } }] };
37
+ 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" } } }] }] } }] };
38
+ 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" } } }] }] } }] };
39
+ 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" } } }] }] } }] };
40
+ 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" } }] } }] };
41
+ 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" } }] } }] };
42
+ 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" } } }] }] } }] };
43
+ 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" } } }] }] } }] };
44
+ 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" } } }] }] } }] };
45
+ 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" } }] } }] };
46
+ 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" } }] } }] } }] };
47
+ 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" } }] } }] } }] };
48
+
49
+ // ../../node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/jsutils/devAssert.mjs
50
+ function devAssert(condition, message) {
51
+ const booleanCondition = Boolean(condition);
52
+ if (!booleanCondition) {
53
+ throw new Error(message);
54
+ }
55
+ }
56
+
57
+ // ../../node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/language/ast.mjs
58
+ var QueryDocumentKeys = {
59
+ Name: [],
60
+ Document: ["definitions"],
61
+ OperationDefinition: [
62
+ "name",
63
+ "variableDefinitions",
64
+ "directives",
65
+ "selectionSet"
66
+ ],
67
+ VariableDefinition: ["variable", "type", "defaultValue", "directives"],
68
+ Variable: ["name"],
69
+ SelectionSet: ["selections"],
70
+ Field: ["alias", "name", "arguments", "directives", "selectionSet"],
71
+ Argument: ["name", "value"],
72
+ FragmentSpread: ["name", "directives"],
73
+ InlineFragment: ["typeCondition", "directives", "selectionSet"],
74
+ FragmentDefinition: [
75
+ "name",
76
+ // Note: fragment variable definitions are deprecated and will removed in v17.0.0
77
+ "variableDefinitions",
78
+ "typeCondition",
79
+ "directives",
80
+ "selectionSet"
81
+ ],
82
+ IntValue: [],
83
+ FloatValue: [],
84
+ StringValue: [],
85
+ BooleanValue: [],
86
+ NullValue: [],
87
+ EnumValue: [],
88
+ ListValue: ["values"],
89
+ ObjectValue: ["fields"],
90
+ ObjectField: ["name", "value"],
91
+ Directive: ["name", "arguments"],
92
+ NamedType: ["name"],
93
+ ListType: ["type"],
94
+ NonNullType: ["type"],
95
+ SchemaDefinition: ["description", "directives", "operationTypes"],
96
+ OperationTypeDefinition: ["type"],
97
+ ScalarTypeDefinition: ["description", "name", "directives"],
98
+ ObjectTypeDefinition: [
99
+ "description",
100
+ "name",
101
+ "interfaces",
102
+ "directives",
103
+ "fields"
104
+ ],
105
+ FieldDefinition: ["description", "name", "arguments", "type", "directives"],
106
+ InputValueDefinition: [
107
+ "description",
108
+ "name",
109
+ "type",
110
+ "defaultValue",
111
+ "directives"
112
+ ],
113
+ InterfaceTypeDefinition: [
114
+ "description",
115
+ "name",
116
+ "interfaces",
117
+ "directives",
118
+ "fields"
119
+ ],
120
+ UnionTypeDefinition: ["description", "name", "directives", "types"],
121
+ EnumTypeDefinition: ["description", "name", "directives", "values"],
122
+ EnumValueDefinition: ["description", "name", "directives"],
123
+ InputObjectTypeDefinition: ["description", "name", "directives", "fields"],
124
+ DirectiveDefinition: ["description", "name", "arguments", "locations"],
125
+ SchemaExtension: ["directives", "operationTypes"],
126
+ ScalarTypeExtension: ["name", "directives"],
127
+ ObjectTypeExtension: ["name", "interfaces", "directives", "fields"],
128
+ InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"],
129
+ UnionTypeExtension: ["name", "directives", "types"],
130
+ EnumTypeExtension: ["name", "directives", "values"],
131
+ InputObjectTypeExtension: ["name", "directives", "fields"]
132
+ };
133
+ var kindValues = new Set(Object.keys(QueryDocumentKeys));
134
+ function isNode(maybeNode) {
135
+ const maybeKind = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind;
136
+ return typeof maybeKind === "string" && kindValues.has(maybeKind);
137
+ }
138
+ var OperationTypeNode;
139
+ (function(OperationTypeNode2) {
140
+ OperationTypeNode2["QUERY"] = "query";
141
+ OperationTypeNode2["MUTATION"] = "mutation";
142
+ OperationTypeNode2["SUBSCRIPTION"] = "subscription";
143
+ })(OperationTypeNode || (OperationTypeNode = {}));
144
+
145
+ // ../../node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/language/kinds.mjs
146
+ exports.Kind = void 0;
147
+ (function(Kind2) {
148
+ Kind2["NAME"] = "Name";
149
+ Kind2["DOCUMENT"] = "Document";
150
+ Kind2["OPERATION_DEFINITION"] = "OperationDefinition";
151
+ Kind2["VARIABLE_DEFINITION"] = "VariableDefinition";
152
+ Kind2["SELECTION_SET"] = "SelectionSet";
153
+ Kind2["FIELD"] = "Field";
154
+ Kind2["ARGUMENT"] = "Argument";
155
+ Kind2["FRAGMENT_SPREAD"] = "FragmentSpread";
156
+ Kind2["INLINE_FRAGMENT"] = "InlineFragment";
157
+ Kind2["FRAGMENT_DEFINITION"] = "FragmentDefinition";
158
+ Kind2["VARIABLE"] = "Variable";
159
+ Kind2["INT"] = "IntValue";
160
+ Kind2["FLOAT"] = "FloatValue";
161
+ Kind2["STRING"] = "StringValue";
162
+ Kind2["BOOLEAN"] = "BooleanValue";
163
+ Kind2["NULL"] = "NullValue";
164
+ Kind2["ENUM"] = "EnumValue";
165
+ Kind2["LIST"] = "ListValue";
166
+ Kind2["OBJECT"] = "ObjectValue";
167
+ Kind2["OBJECT_FIELD"] = "ObjectField";
168
+ Kind2["DIRECTIVE"] = "Directive";
169
+ Kind2["NAMED_TYPE"] = "NamedType";
170
+ Kind2["LIST_TYPE"] = "ListType";
171
+ Kind2["NON_NULL_TYPE"] = "NonNullType";
172
+ Kind2["SCHEMA_DEFINITION"] = "SchemaDefinition";
173
+ Kind2["OPERATION_TYPE_DEFINITION"] = "OperationTypeDefinition";
174
+ Kind2["SCALAR_TYPE_DEFINITION"] = "ScalarTypeDefinition";
175
+ Kind2["OBJECT_TYPE_DEFINITION"] = "ObjectTypeDefinition";
176
+ Kind2["FIELD_DEFINITION"] = "FieldDefinition";
177
+ Kind2["INPUT_VALUE_DEFINITION"] = "InputValueDefinition";
178
+ Kind2["INTERFACE_TYPE_DEFINITION"] = "InterfaceTypeDefinition";
179
+ Kind2["UNION_TYPE_DEFINITION"] = "UnionTypeDefinition";
180
+ Kind2["ENUM_TYPE_DEFINITION"] = "EnumTypeDefinition";
181
+ Kind2["ENUM_VALUE_DEFINITION"] = "EnumValueDefinition";
182
+ Kind2["INPUT_OBJECT_TYPE_DEFINITION"] = "InputObjectTypeDefinition";
183
+ Kind2["DIRECTIVE_DEFINITION"] = "DirectiveDefinition";
184
+ Kind2["SCHEMA_EXTENSION"] = "SchemaExtension";
185
+ Kind2["SCALAR_TYPE_EXTENSION"] = "ScalarTypeExtension";
186
+ Kind2["OBJECT_TYPE_EXTENSION"] = "ObjectTypeExtension";
187
+ Kind2["INTERFACE_TYPE_EXTENSION"] = "InterfaceTypeExtension";
188
+ Kind2["UNION_TYPE_EXTENSION"] = "UnionTypeExtension";
189
+ Kind2["ENUM_TYPE_EXTENSION"] = "EnumTypeExtension";
190
+ Kind2["INPUT_OBJECT_TYPE_EXTENSION"] = "InputObjectTypeExtension";
191
+ })(exports.Kind || (exports.Kind = {}));
192
+
193
+ // ../../node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/language/characterClasses.mjs
194
+ function isWhiteSpace(code) {
195
+ return code === 9 || code === 32;
196
+ }
197
+
198
+ // ../../node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/language/blockString.mjs
199
+ function printBlockString(value, options) {
200
+ const escapedValue = value.replace(/"""/g, '\\"""');
201
+ const lines = escapedValue.split(/\r\n|[\n\r]/g);
202
+ const isSingleLine = lines.length === 1;
203
+ const forceLeadingNewLine = lines.length > 1 && lines.slice(1).every((line) => line.length === 0 || isWhiteSpace(line.charCodeAt(0)));
204
+ const hasTrailingTripleQuotes = escapedValue.endsWith('\\"""');
205
+ const hasTrailingQuote = value.endsWith('"') && !hasTrailingTripleQuotes;
206
+ const hasTrailingSlash = value.endsWith("\\");
207
+ const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash;
208
+ const printAsMultipleLines = // add leading and trailing new lines only if it improves readability
209
+ (!isSingleLine || value.length > 70 || forceTrailingNewline || forceLeadingNewLine || hasTrailingTripleQuotes);
210
+ let result = "";
211
+ const skipLeadingNewLine = isSingleLine && isWhiteSpace(value.charCodeAt(0));
212
+ if (printAsMultipleLines && !skipLeadingNewLine || forceLeadingNewLine) {
213
+ result += "\n";
214
+ }
215
+ result += escapedValue;
216
+ if (printAsMultipleLines || forceTrailingNewline) {
217
+ result += "\n";
218
+ }
219
+ return '"""' + result + '"""';
220
+ }
221
+
222
+ // ../../node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/jsutils/inspect.mjs
223
+ var MAX_ARRAY_LENGTH = 10;
224
+ var MAX_RECURSIVE_DEPTH = 2;
225
+ function inspect(value) {
226
+ return formatValue(value, []);
227
+ }
228
+ function formatValue(value, seenValues) {
229
+ switch (typeof value) {
230
+ case "string":
231
+ return JSON.stringify(value);
232
+ case "function":
233
+ return value.name ? `[function ${value.name}]` : "[function]";
234
+ case "object":
235
+ return formatObjectValue(value, seenValues);
236
+ default:
237
+ return String(value);
238
+ }
239
+ }
240
+ function formatObjectValue(value, previouslySeenValues) {
241
+ if (value === null) {
242
+ return "null";
243
+ }
244
+ if (previouslySeenValues.includes(value)) {
245
+ return "[Circular]";
246
+ }
247
+ const seenValues = [...previouslySeenValues, value];
248
+ if (isJSONable(value)) {
249
+ const jsonValue = value.toJSON();
250
+ if (jsonValue !== value) {
251
+ return typeof jsonValue === "string" ? jsonValue : formatValue(jsonValue, seenValues);
252
+ }
253
+ } else if (Array.isArray(value)) {
254
+ return formatArray(value, seenValues);
255
+ }
256
+ return formatObject(value, seenValues);
257
+ }
258
+ function isJSONable(value) {
259
+ return typeof value.toJSON === "function";
260
+ }
261
+ function formatObject(object, seenValues) {
262
+ const entries = Object.entries(object);
263
+ if (entries.length === 0) {
264
+ return "{}";
265
+ }
266
+ if (seenValues.length > MAX_RECURSIVE_DEPTH) {
267
+ return "[" + getObjectTag(object) + "]";
268
+ }
269
+ const properties = entries.map(
270
+ ([key, value]) => key + ": " + formatValue(value, seenValues)
271
+ );
272
+ return "{ " + properties.join(", ") + " }";
273
+ }
274
+ function formatArray(array, seenValues) {
275
+ if (array.length === 0) {
276
+ return "[]";
277
+ }
278
+ if (seenValues.length > MAX_RECURSIVE_DEPTH) {
279
+ return "[Array]";
280
+ }
281
+ const len = Math.min(MAX_ARRAY_LENGTH, array.length);
282
+ const remaining = array.length - len;
283
+ const items = [];
284
+ for (let i = 0; i < len; ++i) {
285
+ items.push(formatValue(array[i], seenValues));
286
+ }
287
+ if (remaining === 1) {
288
+ items.push("... 1 more item");
289
+ } else if (remaining > 1) {
290
+ items.push(`... ${remaining} more items`);
291
+ }
292
+ return "[" + items.join(", ") + "]";
293
+ }
294
+ function getObjectTag(object) {
295
+ const tag = Object.prototype.toString.call(object).replace(/^\[object /, "").replace(/]$/, "");
296
+ if (tag === "Object" && typeof object.constructor === "function") {
297
+ const name = object.constructor.name;
298
+ if (typeof name === "string" && name !== "") {
299
+ return name;
300
+ }
301
+ }
302
+ return tag;
303
+ }
304
+
305
+ // ../../node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/language/printString.mjs
306
+ function printString(str) {
307
+ return `"${str.replace(escapedRegExp, escapedReplacer)}"`;
308
+ }
309
+ var escapedRegExp = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
310
+ function escapedReplacer(str) {
311
+ return escapeSequences[str.charCodeAt(0)];
312
+ }
313
+ var escapeSequences = [
314
+ "\\u0000",
315
+ "\\u0001",
316
+ "\\u0002",
317
+ "\\u0003",
318
+ "\\u0004",
319
+ "\\u0005",
320
+ "\\u0006",
321
+ "\\u0007",
322
+ "\\b",
323
+ "\\t",
324
+ "\\n",
325
+ "\\u000B",
326
+ "\\f",
327
+ "\\r",
328
+ "\\u000E",
329
+ "\\u000F",
330
+ "\\u0010",
331
+ "\\u0011",
332
+ "\\u0012",
333
+ "\\u0013",
334
+ "\\u0014",
335
+ "\\u0015",
336
+ "\\u0016",
337
+ "\\u0017",
338
+ "\\u0018",
339
+ "\\u0019",
340
+ "\\u001A",
341
+ "\\u001B",
342
+ "\\u001C",
343
+ "\\u001D",
344
+ "\\u001E",
345
+ "\\u001F",
346
+ "",
347
+ "",
348
+ '\\"',
349
+ "",
350
+ "",
351
+ "",
352
+ "",
353
+ "",
354
+ "",
355
+ "",
356
+ "",
357
+ "",
358
+ "",
359
+ "",
360
+ "",
361
+ "",
362
+ // 2F
363
+ "",
364
+ "",
365
+ "",
366
+ "",
367
+ "",
368
+ "",
369
+ "",
370
+ "",
371
+ "",
372
+ "",
373
+ "",
374
+ "",
375
+ "",
376
+ "",
377
+ "",
378
+ "",
379
+ // 3F
380
+ "",
381
+ "",
382
+ "",
383
+ "",
384
+ "",
385
+ "",
386
+ "",
387
+ "",
388
+ "",
389
+ "",
390
+ "",
391
+ "",
392
+ "",
393
+ "",
394
+ "",
395
+ "",
396
+ // 4F
397
+ "",
398
+ "",
399
+ "",
400
+ "",
401
+ "",
402
+ "",
403
+ "",
404
+ "",
405
+ "",
406
+ "",
407
+ "",
408
+ "",
409
+ "\\\\",
410
+ "",
411
+ "",
412
+ "",
413
+ // 5F
414
+ "",
415
+ "",
416
+ "",
417
+ "",
418
+ "",
419
+ "",
420
+ "",
421
+ "",
422
+ "",
423
+ "",
424
+ "",
425
+ "",
426
+ "",
427
+ "",
428
+ "",
429
+ "",
430
+ // 6F
431
+ "",
432
+ "",
433
+ "",
434
+ "",
435
+ "",
436
+ "",
437
+ "",
438
+ "",
439
+ "",
440
+ "",
441
+ "",
442
+ "",
443
+ "",
444
+ "",
445
+ "",
446
+ "\\u007F",
447
+ "\\u0080",
448
+ "\\u0081",
449
+ "\\u0082",
450
+ "\\u0083",
451
+ "\\u0084",
452
+ "\\u0085",
453
+ "\\u0086",
454
+ "\\u0087",
455
+ "\\u0088",
456
+ "\\u0089",
457
+ "\\u008A",
458
+ "\\u008B",
459
+ "\\u008C",
460
+ "\\u008D",
461
+ "\\u008E",
462
+ "\\u008F",
463
+ "\\u0090",
464
+ "\\u0091",
465
+ "\\u0092",
466
+ "\\u0093",
467
+ "\\u0094",
468
+ "\\u0095",
469
+ "\\u0096",
470
+ "\\u0097",
471
+ "\\u0098",
472
+ "\\u0099",
473
+ "\\u009A",
474
+ "\\u009B",
475
+ "\\u009C",
476
+ "\\u009D",
477
+ "\\u009E",
478
+ "\\u009F"
479
+ ];
480
+
481
+ // ../../node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/language/visitor.mjs
482
+ var BREAK = Object.freeze({});
483
+ function visit(root, visitor, visitorKeys = QueryDocumentKeys) {
484
+ const enterLeaveMap = /* @__PURE__ */ new Map();
485
+ for (const kind of Object.values(exports.Kind)) {
486
+ enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind));
487
+ }
488
+ let stack = void 0;
489
+ let inArray = Array.isArray(root);
490
+ let keys = [root];
491
+ let index = -1;
492
+ let edits = [];
493
+ let node = root;
494
+ let key = void 0;
495
+ let parent = void 0;
496
+ const path = [];
497
+ const ancestors = [];
498
+ do {
499
+ index++;
500
+ const isLeaving = index === keys.length;
501
+ const isEdited = isLeaving && edits.length !== 0;
502
+ if (isLeaving) {
503
+ key = ancestors.length === 0 ? void 0 : path[path.length - 1];
504
+ node = parent;
505
+ parent = ancestors.pop();
506
+ if (isEdited) {
507
+ if (inArray) {
508
+ node = node.slice();
509
+ let editOffset = 0;
510
+ for (const [editKey, editValue] of edits) {
511
+ const arrayKey = editKey - editOffset;
512
+ if (editValue === null) {
513
+ node.splice(arrayKey, 1);
514
+ editOffset++;
515
+ } else {
516
+ node[arrayKey] = editValue;
517
+ }
518
+ }
519
+ } else {
520
+ node = Object.defineProperties(
521
+ {},
522
+ Object.getOwnPropertyDescriptors(node)
523
+ );
524
+ for (const [editKey, editValue] of edits) {
525
+ node[editKey] = editValue;
526
+ }
527
+ }
528
+ }
529
+ index = stack.index;
530
+ keys = stack.keys;
531
+ edits = stack.edits;
532
+ inArray = stack.inArray;
533
+ stack = stack.prev;
534
+ } else if (parent) {
535
+ key = inArray ? index : keys[index];
536
+ node = parent[key];
537
+ if (node === null || node === void 0) {
538
+ continue;
539
+ }
540
+ path.push(key);
541
+ }
542
+ let result;
543
+ if (!Array.isArray(node)) {
544
+ var _enterLeaveMap$get, _enterLeaveMap$get2;
545
+ isNode(node) || devAssert(false, `Invalid AST Node: ${inspect(node)}.`);
546
+ 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;
547
+ result = visitFn === null || visitFn === void 0 ? void 0 : visitFn.call(visitor, node, key, parent, path, ancestors);
548
+ if (result === BREAK) {
549
+ break;
550
+ }
551
+ if (result === false) {
552
+ if (!isLeaving) {
553
+ path.pop();
554
+ continue;
555
+ }
556
+ } else if (result !== void 0) {
557
+ edits.push([key, result]);
558
+ if (!isLeaving) {
559
+ if (isNode(result)) {
560
+ node = result;
561
+ } else {
562
+ path.pop();
563
+ continue;
564
+ }
565
+ }
566
+ }
567
+ }
568
+ if (result === void 0 && isEdited) {
569
+ edits.push([key, node]);
570
+ }
571
+ if (isLeaving) {
572
+ path.pop();
573
+ } else {
574
+ var _node$kind;
575
+ stack = {
576
+ inArray,
577
+ index,
578
+ keys,
579
+ edits,
580
+ prev: stack
581
+ };
582
+ inArray = Array.isArray(node);
583
+ keys = inArray ? node : (_node$kind = visitorKeys[node.kind]) !== null && _node$kind !== void 0 ? _node$kind : [];
584
+ index = -1;
585
+ edits = [];
586
+ if (parent) {
587
+ ancestors.push(parent);
588
+ }
589
+ parent = node;
590
+ }
591
+ } while (stack !== void 0);
592
+ if (edits.length !== 0) {
593
+ return edits[edits.length - 1][1];
594
+ }
595
+ return root;
596
+ }
597
+ function getEnterLeaveForKind(visitor, kind) {
598
+ const kindVisitor = visitor[kind];
599
+ if (typeof kindVisitor === "object") {
600
+ return kindVisitor;
601
+ } else if (typeof kindVisitor === "function") {
602
+ return {
603
+ enter: kindVisitor,
604
+ leave: void 0
605
+ };
606
+ }
607
+ return {
608
+ enter: visitor.enter,
609
+ leave: visitor.leave
610
+ };
611
+ }
612
+
613
+ // ../../node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/language/printer.mjs
614
+ function print(ast) {
615
+ return visit(ast, printDocASTReducer);
616
+ }
617
+ var MAX_LINE_LENGTH = 80;
618
+ var printDocASTReducer = {
619
+ Name: {
620
+ leave: (node) => node.value
621
+ },
622
+ Variable: {
623
+ leave: (node) => "$" + node.name
624
+ },
625
+ // Document
626
+ Document: {
627
+ leave: (node) => join(node.definitions, "\n\n")
628
+ },
629
+ OperationDefinition: {
630
+ leave(node) {
631
+ const varDefs = wrap("(", join(node.variableDefinitions, ", "), ")");
632
+ const prefix = join(
633
+ [
634
+ node.operation,
635
+ join([node.name, varDefs]),
636
+ join(node.directives, " ")
637
+ ],
638
+ " "
639
+ );
640
+ return (prefix === "query" ? "" : prefix + " ") + node.selectionSet;
641
+ }
642
+ },
643
+ VariableDefinition: {
644
+ leave: ({ variable, type, defaultValue, directives }) => variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ", join(directives, " "))
645
+ },
646
+ SelectionSet: {
647
+ leave: ({ selections }) => block(selections)
648
+ },
649
+ Field: {
650
+ leave({ alias, name, arguments: args, directives, selectionSet }) {
651
+ const prefix = wrap("", alias, ": ") + name;
652
+ let argsLine = prefix + wrap("(", join(args, ", "), ")");
653
+ if (argsLine.length > MAX_LINE_LENGTH) {
654
+ argsLine = prefix + wrap("(\n", indent(join(args, "\n")), "\n)");
655
+ }
656
+ return join([argsLine, join(directives, " "), selectionSet], " ");
657
+ }
658
+ },
659
+ Argument: {
660
+ leave: ({ name, value }) => name + ": " + value
661
+ },
662
+ // Fragments
663
+ FragmentSpread: {
664
+ leave: ({ name, directives }) => "..." + name + wrap(" ", join(directives, " "))
665
+ },
666
+ InlineFragment: {
667
+ leave: ({ typeCondition, directives, selectionSet }) => join(
668
+ [
669
+ "...",
670
+ wrap("on ", typeCondition),
671
+ join(directives, " "),
672
+ selectionSet
673
+ ],
674
+ " "
675
+ )
676
+ },
677
+ FragmentDefinition: {
678
+ leave: ({ name, typeCondition, variableDefinitions, directives, selectionSet }) => (
679
+ // or removed in the future.
680
+ `fragment ${name}${wrap("(", join(variableDefinitions, ", "), ")")} on ${typeCondition} ${wrap("", join(directives, " "), " ")}` + selectionSet
681
+ )
682
+ },
683
+ // Value
684
+ IntValue: {
685
+ leave: ({ value }) => value
686
+ },
687
+ FloatValue: {
688
+ leave: ({ value }) => value
689
+ },
690
+ StringValue: {
691
+ leave: ({ value, block: isBlockString }) => isBlockString ? printBlockString(value) : printString(value)
692
+ },
693
+ BooleanValue: {
694
+ leave: ({ value }) => value ? "true" : "false"
695
+ },
696
+ NullValue: {
697
+ leave: () => "null"
698
+ },
699
+ EnumValue: {
700
+ leave: ({ value }) => value
701
+ },
702
+ ListValue: {
703
+ leave: ({ values }) => "[" + join(values, ", ") + "]"
704
+ },
705
+ ObjectValue: {
706
+ leave: ({ fields }) => "{" + join(fields, ", ") + "}"
707
+ },
708
+ ObjectField: {
709
+ leave: ({ name, value }) => name + ": " + value
710
+ },
711
+ // Directive
712
+ Directive: {
713
+ leave: ({ name, arguments: args }) => "@" + name + wrap("(", join(args, ", "), ")")
714
+ },
715
+ // Type
716
+ NamedType: {
717
+ leave: ({ name }) => name
718
+ },
719
+ ListType: {
720
+ leave: ({ type }) => "[" + type + "]"
721
+ },
722
+ NonNullType: {
723
+ leave: ({ type }) => type + "!"
724
+ },
725
+ // Type System Definitions
726
+ SchemaDefinition: {
727
+ leave: ({ description, directives, operationTypes }) => wrap("", description, "\n") + join(["schema", join(directives, " "), block(operationTypes)], " ")
728
+ },
729
+ OperationTypeDefinition: {
730
+ leave: ({ operation, type }) => operation + ": " + type
731
+ },
732
+ ScalarTypeDefinition: {
733
+ leave: ({ description, name, directives }) => wrap("", description, "\n") + join(["scalar", name, join(directives, " ")], " ")
734
+ },
735
+ ObjectTypeDefinition: {
736
+ leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join(
737
+ [
738
+ "type",
739
+ name,
740
+ wrap("implements ", join(interfaces, " & ")),
741
+ join(directives, " "),
742
+ block(fields)
743
+ ],
744
+ " "
745
+ )
746
+ },
747
+ FieldDefinition: {
748
+ 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, " "))
749
+ },
750
+ InputValueDefinition: {
751
+ leave: ({ description, name, type, defaultValue, directives }) => wrap("", description, "\n") + join(
752
+ [name + ": " + type, wrap("= ", defaultValue), join(directives, " ")],
753
+ " "
754
+ )
755
+ },
756
+ InterfaceTypeDefinition: {
757
+ leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join(
758
+ [
759
+ "interface",
760
+ name,
761
+ wrap("implements ", join(interfaces, " & ")),
762
+ join(directives, " "),
763
+ block(fields)
764
+ ],
765
+ " "
766
+ )
767
+ },
768
+ UnionTypeDefinition: {
769
+ leave: ({ description, name, directives, types }) => wrap("", description, "\n") + join(
770
+ ["union", name, join(directives, " "), wrap("= ", join(types, " | "))],
771
+ " "
772
+ )
773
+ },
774
+ EnumTypeDefinition: {
775
+ leave: ({ description, name, directives, values }) => wrap("", description, "\n") + join(["enum", name, join(directives, " "), block(values)], " ")
776
+ },
777
+ EnumValueDefinition: {
778
+ leave: ({ description, name, directives }) => wrap("", description, "\n") + join([name, join(directives, " ")], " ")
779
+ },
780
+ InputObjectTypeDefinition: {
781
+ leave: ({ description, name, directives, fields }) => wrap("", description, "\n") + join(["input", name, join(directives, " "), block(fields)], " ")
782
+ },
783
+ DirectiveDefinition: {
784
+ 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, " | ")
785
+ },
786
+ SchemaExtension: {
787
+ leave: ({ directives, operationTypes }) => join(
788
+ ["extend schema", join(directives, " "), block(operationTypes)],
789
+ " "
790
+ )
791
+ },
792
+ ScalarTypeExtension: {
793
+ leave: ({ name, directives }) => join(["extend scalar", name, join(directives, " ")], " ")
794
+ },
795
+ ObjectTypeExtension: {
796
+ leave: ({ name, interfaces, directives, fields }) => join(
797
+ [
798
+ "extend type",
799
+ name,
800
+ wrap("implements ", join(interfaces, " & ")),
801
+ join(directives, " "),
802
+ block(fields)
803
+ ],
804
+ " "
805
+ )
806
+ },
807
+ InterfaceTypeExtension: {
808
+ leave: ({ name, interfaces, directives, fields }) => join(
809
+ [
810
+ "extend interface",
811
+ name,
812
+ wrap("implements ", join(interfaces, " & ")),
813
+ join(directives, " "),
814
+ block(fields)
815
+ ],
816
+ " "
817
+ )
818
+ },
819
+ UnionTypeExtension: {
820
+ leave: ({ name, directives, types }) => join(
821
+ [
822
+ "extend union",
823
+ name,
824
+ join(directives, " "),
825
+ wrap("= ", join(types, " | "))
826
+ ],
827
+ " "
828
+ )
829
+ },
830
+ EnumTypeExtension: {
831
+ leave: ({ name, directives, values }) => join(["extend enum", name, join(directives, " "), block(values)], " ")
832
+ },
833
+ InputObjectTypeExtension: {
834
+ leave: ({ name, directives, fields }) => join(["extend input", name, join(directives, " "), block(fields)], " ")
835
+ }
836
+ };
837
+ function join(maybeArray, separator = "") {
838
+ var _maybeArray$filter$jo;
839
+ 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 : "";
840
+ }
841
+ function block(array) {
842
+ return wrap("{\n", indent(join(array, "\n")), "\n}");
843
+ }
844
+ function wrap(start, maybeString, end = "") {
845
+ return maybeString != null && maybeString !== "" ? start + maybeString + end : "";
846
+ }
847
+ function indent(str) {
848
+ return wrap(" ", str.replace(/\n/g, "\n "));
849
+ }
850
+ function hasMultilineItems(maybeArray) {
851
+ var _maybeArray$some;
852
+ return (_maybeArray$some = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.some((str) => str.includes("\n"))) !== null && _maybeArray$some !== void 0 ? _maybeArray$some : false;
853
+ }
854
+
855
+ // src/transport/http.ts
856
+ var printCache = /* @__PURE__ */ new WeakMap();
857
+ function printDocument(document) {
858
+ let cached = printCache.get(document);
859
+ if (!cached) {
860
+ cached = print(document);
861
+ printCache.set(document, cached);
862
+ }
863
+ return cached;
864
+ }
865
+ var NON_AUTH_CODES = /* @__PURE__ */ new Set([
866
+ chunkKV5SP7RP_cjs.GRAPHQL_ERROR_CODES.SESSION_TOKEN_LIMIT_REACHED,
867
+ chunkKV5SP7RP_cjs.GRAPHQL_ERROR_CODES.STORAGE_LIMIT_REACHED,
868
+ chunkKV5SP7RP_cjs.GRAPHQL_ERROR_CODES.DEEP_ANALYSIS_LIMIT_EXCEEDED,
869
+ chunkKV5SP7RP_cjs.GRAPHQL_ERROR_CODES.PLAN_DETAIL_RESTRICTION,
870
+ chunkKV5SP7RP_cjs.GRAPHQL_ERROR_CODES.RESOURCE_NOT_FOUND
871
+ ]);
872
+ function isAuthError(errors, status) {
873
+ if (errors) {
874
+ for (const err of errors) {
875
+ const rawCode = err.extensions?.["code"];
876
+ if (rawCode === void 0 || rawCode === null) continue;
877
+ if (rawCode === 4401 || rawCode === "4401") return true;
878
+ const code = String(rawCode).toUpperCase();
879
+ if (NON_AUTH_CODES.has(code)) return false;
880
+ if (code === "UNAUTHORIZED" || code === "UNAUTHENTICATED" || err.message === "Unauthorized") {
881
+ return true;
882
+ }
883
+ }
884
+ }
885
+ return false;
886
+ }
887
+ async function doFetch(options, document, variables) {
888
+ const token = await options.getToken();
889
+ const lang = options.getLanguage();
890
+ const headers = {
891
+ "Content-Type": "application/json",
892
+ Authorization: `Bearer ${token}`
893
+ };
894
+ if (lang) {
895
+ headers["x-preferred-language"] = lang;
896
+ }
897
+ const body = JSON.stringify({
898
+ query: printDocument(document),
899
+ variables
900
+ });
901
+ const response = await fetch(options.url, {
902
+ method: "POST",
903
+ headers,
904
+ body
905
+ });
906
+ if (!response.ok) {
907
+ if (response.status === 401 || response.status === 403) {
908
+ throw new chunkKV5SP7RP_cjs.DvinaAuthenticationError(`Authentication failed with status ${response.status}`, token);
909
+ }
910
+ throw new chunkKV5SP7RP_cjs.DvinaNetworkError(`HTTP ${response.status}: ${response.statusText}`, response.status);
911
+ }
912
+ return { response: await response.json(), usedToken: token };
913
+ }
914
+ var MAX_RETRIES = 4;
915
+ var RETRY_DELAY_MS = 1e3;
916
+ function createHttpTransport(options) {
917
+ const refreshState = {
918
+ isRefreshing: false,
919
+ pendingRequests: []
920
+ };
921
+ async function requestWithRetry(document, variables, attempt = 0) {
922
+ let fetchResult;
923
+ try {
924
+ fetchResult = await doFetch(options, document, variables);
925
+ } catch (error) {
926
+ if (error instanceof chunkKV5SP7RP_cjs.DvinaAuthenticationError) {
927
+ return handleAuthRefresh(document, variables, refreshState, options, error.failedToken);
928
+ }
929
+ if (error instanceof chunkKV5SP7RP_cjs.DvinaNetworkError && error.status === 0 && attempt < MAX_RETRIES) {
930
+ await sleep(RETRY_DELAY_MS * (attempt + 1));
931
+ return requestWithRetry(document, variables, attempt + 1);
932
+ }
933
+ if (error instanceof chunkKV5SP7RP_cjs.DvinaError) options.onError?.(error);
934
+ throw error;
935
+ }
936
+ const { response: result, usedToken } = fetchResult;
937
+ if (isAuthError(result.errors)) {
938
+ return handleAuthRefresh(document, variables, refreshState, options, usedToken);
939
+ }
940
+ if (result.errors?.length && !result.data) {
941
+ const error = chunkKV5SP7RP_cjs.createGraphQLError(result.errors, printDocument(document), variables);
942
+ options.onError?.(error);
943
+ throw error;
944
+ }
945
+ if (!result.data) {
946
+ const error = chunkKV5SP7RP_cjs.createGraphQLError(
947
+ [{ message: "No data returned from server" }],
948
+ printDocument(document),
949
+ variables
950
+ );
951
+ options.onError?.(error);
952
+ throw error;
953
+ }
954
+ return result.data;
955
+ }
956
+ return {
957
+ request: (document, variables) => requestWithRetry(document, variables)
958
+ };
959
+ }
960
+ async function handleAuthRefresh(document, variables, refreshState, options, failedToken) {
961
+ if (!refreshState.isRefreshing) {
962
+ refreshState.isRefreshing = true;
963
+ try {
964
+ const newToken = await options.getToken({ forceRefresh: true });
965
+ if (failedToken && newToken === failedToken) {
966
+ throw new chunkKV5SP7RP_cjs.DvinaAuthenticationError("Token refresh did not produce a new token");
967
+ }
968
+ refreshState.pendingRequests.forEach((req) => req.resolve());
969
+ refreshState.pendingRequests = [];
970
+ refreshState.isRefreshing = false;
971
+ } catch {
972
+ const error = new chunkKV5SP7RP_cjs.DvinaAuthenticationError("Token refresh failed");
973
+ options.onError?.(error);
974
+ refreshState.pendingRequests.forEach((req) => req.reject(error));
975
+ refreshState.pendingRequests = [];
976
+ refreshState.isRefreshing = false;
977
+ throw error;
978
+ }
979
+ return retryAfterRefresh(options, document, variables);
980
+ }
981
+ await new Promise((resolve, reject) => {
982
+ refreshState.pendingRequests.push({ resolve, reject });
983
+ });
984
+ return retryAfterRefresh(options, document, variables);
985
+ }
986
+ async function retryAfterRefresh(options, document, variables) {
987
+ const { response: result } = await doFetch(options, document, variables);
988
+ if (isAuthError(result.errors)) {
989
+ const error = new chunkKV5SP7RP_cjs.DvinaAuthenticationError("Authentication failed after token refresh");
990
+ options.onError?.(error);
991
+ throw error;
992
+ }
993
+ if (result.errors?.length && !result.data) {
994
+ const error = chunkKV5SP7RP_cjs.createGraphQLError(result.errors, printDocument(document), variables);
995
+ options.onError?.(error);
996
+ throw error;
997
+ }
998
+ return result.data;
999
+ }
1000
+ function sleep(ms) {
1001
+ return new Promise((resolve) => setTimeout(resolve, ms));
1002
+ }
1003
+
1004
+ // src/billing/client.ts
1005
+ var INITIAL_RECONNECT_DELAY_MS = 1e3;
1006
+ var MAX_RECONNECT_DELAY_MS = 3e4;
1007
+ var RECONNECT_BACKOFF_MULTIPLIER = 2;
1008
+ var MAX_CONSECUTIVE_AUTH_FAILURES = 3;
1009
+ var BillingClient = class {
1010
+ http;
1011
+ options;
1012
+ activeAbortControllers = /* @__PURE__ */ new Set();
1013
+ constructor(options) {
1014
+ this.options = options;
1015
+ this.http = createHttpTransport({
1016
+ url: options.billingHttpUrl,
1017
+ getToken: options.getToken,
1018
+ getLanguage: () => void 0,
1019
+ onError: options.onError
1020
+ });
1021
+ }
1022
+ /**
1023
+ * Terminate all active SSE streams.
1024
+ * Call this on logout or SDK teardown to prevent lingering connections.
1025
+ */
1026
+ destroy() {
1027
+ for (const controller of this.activeAbortControllers) {
1028
+ controller.abort();
1029
+ }
1030
+ this.activeAbortControllers.clear();
1031
+ }
1032
+ // ─── Plans ───────────────────────────────────────────────────────────────
1033
+ get plans() {
1034
+ return {
1035
+ list: async () => {
1036
+ const result = await this.request(PlansDocument);
1037
+ return result.plans;
1038
+ },
1039
+ get: async (variables) => {
1040
+ const result = await this.request(PlanDocument, variables);
1041
+ return result.plan;
1042
+ },
1043
+ entitlements: async () => {
1044
+ const result = await this.request(EntitlementsDocument);
1045
+ return result.entitlements;
1046
+ },
1047
+ tierOrders: async () => {
1048
+ const result = await this.request(TierOrdersDocument);
1049
+ return result.tierOrders;
1050
+ }
1051
+ };
1052
+ }
1053
+ // ─── Subscription ────────────────────────────────────────────────────────
1054
+ get subscription() {
1055
+ return {
1056
+ get: async () => {
1057
+ const result = await this.request(SubscriptionDocument);
1058
+ return result.subscription;
1059
+ },
1060
+ entitlements: async () => {
1061
+ const result = await this.request(SubscriptionEntitlementsDocument);
1062
+ return result.subscriptionEntitlements;
1063
+ },
1064
+ upgrade: async (variables) => {
1065
+ const result = await this.request(UpgradePlanDocument, variables);
1066
+ return result.upgradePlan;
1067
+ },
1068
+ prorationAmount: async (variables) => {
1069
+ const result = await this.request(ProrationAmountDocument, variables);
1070
+ return result.prorationAmount;
1071
+ },
1072
+ downgrade: async (variables) => {
1073
+ const result = await this.request(DowngradePlanDocument, variables);
1074
+ return result.downgradePlan;
1075
+ },
1076
+ changeBillingCycle: async (variables) => {
1077
+ const result = await this.request(ChangeBillingCycleDocument, variables);
1078
+ return result.changeBillingCycle;
1079
+ },
1080
+ cancel: async () => {
1081
+ const result = await this.request(CancelSubscriptionDocument);
1082
+ return result.cancelSubscription;
1083
+ },
1084
+ reactivate: async () => {
1085
+ const result = await this.request(ReactivateSubscriptionDocument);
1086
+ return result.reactivateSubscription;
1087
+ },
1088
+ releaseSchedule: async () => {
1089
+ const result = await this.request(ReleaseScheduleDocument);
1090
+ return result.releaseSchedule;
1091
+ },
1092
+ /**
1093
+ * Subscribe to real-time subscription updates via SSE.
1094
+ * Returns an AsyncIterable that yields WorkspaceSubscription snapshots.
1095
+ * Automatically reconnects with exponential backoff and token refresh on auth errors.
1096
+ */
1097
+ updates: () => {
1098
+ return this.createSseStream();
1099
+ }
1100
+ };
1101
+ }
1102
+ // ─── Seats ───────────────────────────────────────────────────────────────
1103
+ get seats() {
1104
+ return {
1105
+ add: async (variables) => {
1106
+ const result = await this.request(AddSeatsDocument, variables);
1107
+ return result.addSeats;
1108
+ },
1109
+ remove: async (variables) => {
1110
+ const result = await this.request(RemoveSeatsDocument, variables);
1111
+ return result.removeSeats;
1112
+ }
1113
+ };
1114
+ }
1115
+ // ─── Sessions ────────────────────────────────────────────────────────────
1116
+ get session() {
1117
+ return {
1118
+ createSession: async (variables) => {
1119
+ const result = await this.request(CreateCheckoutSessionDocument, variables);
1120
+ return result.createCheckoutSession;
1121
+ },
1122
+ createCustomerPortalSession: async (variables) => {
1123
+ const result = await this.request(CreateCustomerPortalSessionDocument, variables);
1124
+ return result.createCustomerPortalSession;
1125
+ }
1126
+ };
1127
+ }
1128
+ // ─── Management ──────────────────────────────────────────────────────────
1129
+ get management() {
1130
+ return {
1131
+ subscription: async (variables) => {
1132
+ const result = await this.request(SubscriptionForManagerDocument, variables);
1133
+ return result.subscriptionForManager;
1134
+ },
1135
+ entitlements: async (variables) => {
1136
+ const result = await this.request(SubscriptionEntitlementsForManagerDocument, variables);
1137
+ return result.subscriptionEntitlementsForManager;
1138
+ },
1139
+ cancel: async (variables) => {
1140
+ const result = await this.request(CancelSubscriptionForManagerDocument, variables);
1141
+ return result.cancelSubscriptionForManager;
1142
+ },
1143
+ reactivate: async (variables) => {
1144
+ const result = await this.request(ReactivateSubscriptionForManagerDocument, variables);
1145
+ return result.reactivateSubscriptionForManager;
1146
+ },
1147
+ createCustomer: async (variables) => {
1148
+ const result = await this.request(CreateCustomerDocument, variables);
1149
+ return result.createCustomer;
1150
+ }
1151
+ };
1152
+ }
1153
+ // ─── Private ─────────────────────────────────────────────────────────────
1154
+ request(document, variables) {
1155
+ return this.http.request(document, variables);
1156
+ }
1157
+ /**
1158
+ * Create an SSE stream that connects to the billing SSE endpoint.
1159
+ * Reconnects automatically with exponential backoff.
1160
+ * On 401/403, refreshes the token and retries with a short delay.
1161
+ */
1162
+ createSseStream() {
1163
+ const options = this.options;
1164
+ const activeAbortControllers = this.activeAbortControllers;
1165
+ return {
1166
+ [Symbol.asyncIterator]() {
1167
+ const queue = [];
1168
+ let resolve = null;
1169
+ let done = false;
1170
+ let abortController;
1171
+ let reconnectTimer;
1172
+ let reconnectDelay = INITIAL_RECONNECT_DELAY_MS;
1173
+ let shouldReconnect = true;
1174
+ let needsForceRefresh = false;
1175
+ let consecutiveAuthFailures = 0;
1176
+ function push(value) {
1177
+ if (resolve) {
1178
+ resolve({ value, done: false });
1179
+ resolve = null;
1180
+ } else {
1181
+ queue.length = 0;
1182
+ queue.push(value);
1183
+ }
1184
+ }
1185
+ async function connect() {
1186
+ if (!shouldReconnect) return;
1187
+ if (abortController) {
1188
+ activeAbortControllers.delete(abortController);
1189
+ }
1190
+ abortController = new AbortController();
1191
+ activeAbortControllers.add(abortController);
1192
+ try {
1193
+ const forceRefresh = needsForceRefresh;
1194
+ needsForceRefresh = false;
1195
+ const token = await options.getToken(forceRefresh ? { forceRefresh: true } : void 0);
1196
+ const response = await fetch(options.billingSseUrl, {
1197
+ method: "GET",
1198
+ headers: {
1199
+ Authorization: `Bearer ${token}`,
1200
+ Accept: "text/event-stream",
1201
+ "Cache-Control": "no-cache"
1202
+ },
1203
+ signal: abortController.signal
1204
+ });
1205
+ if (!response.ok) {
1206
+ if (response.status === 401 || response.status === 403) {
1207
+ consecutiveAuthFailures++;
1208
+ if (consecutiveAuthFailures >= MAX_CONSECUTIVE_AUTH_FAILURES) {
1209
+ done = true;
1210
+ shouldReconnect = false;
1211
+ options.onError?.(
1212
+ new chunkKV5SP7RP_cjs.DvinaAuthenticationError(
1213
+ "Billing SSE stream authentication failed permanently"
1214
+ )
1215
+ );
1216
+ if (resolve) {
1217
+ resolve({ value: void 0, done: true });
1218
+ resolve = null;
1219
+ }
1220
+ return;
1221
+ }
1222
+ needsForceRefresh = true;
1223
+ scheduleReconnect(INITIAL_RECONNECT_DELAY_MS);
1224
+ return;
1225
+ }
1226
+ throw new Error(`Billing SSE failed: ${response.status} ${response.statusText}`);
1227
+ }
1228
+ if (!response.body) {
1229
+ throw new Error("Billing SSE response has no body");
1230
+ }
1231
+ consecutiveAuthFailures = 0;
1232
+ reconnectDelay = INITIAL_RECONNECT_DELAY_MS;
1233
+ await parseSseStream(response.body, abortController.signal);
1234
+ } catch (err) {
1235
+ if (err.name === "AbortError") return;
1236
+ if (shouldReconnect) {
1237
+ scheduleReconnect(reconnectDelay);
1238
+ reconnectDelay = Math.min(
1239
+ reconnectDelay * RECONNECT_BACKOFF_MULTIPLIER,
1240
+ MAX_RECONNECT_DELAY_MS
1241
+ );
1242
+ }
1243
+ }
1244
+ }
1245
+ async function parseSseStream(body, signal) {
1246
+ const reader = body.getReader();
1247
+ const decoder = new TextDecoder();
1248
+ let buffer = "";
1249
+ try {
1250
+ while (!signal.aborted && shouldReconnect) {
1251
+ const { done: streamDone, value } = await reader.read();
1252
+ if (streamDone) break;
1253
+ buffer += decoder.decode(value, { stream: true });
1254
+ const parts = buffer.split(/(?:\r\n|\r|\n){2}/);
1255
+ buffer = parts.pop() ?? "";
1256
+ for (const part of parts) {
1257
+ processEventBlock(part.trim());
1258
+ }
1259
+ }
1260
+ } finally {
1261
+ reader.releaseLock();
1262
+ }
1263
+ if (shouldReconnect) {
1264
+ scheduleReconnect(reconnectDelay);
1265
+ }
1266
+ }
1267
+ function processEventBlock(block2) {
1268
+ if (!block2 || block2.startsWith(":")) return;
1269
+ let eventType;
1270
+ let eventData;
1271
+ for (const line of block2.split(/\r\n|\r|\n/)) {
1272
+ if (line.startsWith("event: ")) {
1273
+ eventType = line.slice(7).trim();
1274
+ } else if (line.startsWith("data: ")) {
1275
+ eventData = line.slice(6);
1276
+ }
1277
+ }
1278
+ if (eventType === "token-expired") {
1279
+ needsForceRefresh = true;
1280
+ return;
1281
+ }
1282
+ if (eventType === "subscription" && eventData) {
1283
+ try {
1284
+ const parsed = JSON.parse(eventData);
1285
+ push(parsed);
1286
+ } catch {
1287
+ }
1288
+ }
1289
+ }
1290
+ function scheduleReconnect(delay) {
1291
+ if (!shouldReconnect) return;
1292
+ reconnectTimer = setTimeout(() => {
1293
+ connect();
1294
+ }, delay);
1295
+ }
1296
+ connect();
1297
+ return {
1298
+ next() {
1299
+ if (queue.length > 0) {
1300
+ return Promise.resolve({ value: queue.shift(), done: false });
1301
+ }
1302
+ if (done) {
1303
+ return Promise.resolve({
1304
+ value: void 0,
1305
+ done: true
1306
+ });
1307
+ }
1308
+ return new Promise((r) => {
1309
+ resolve = r;
1310
+ });
1311
+ },
1312
+ return() {
1313
+ shouldReconnect = false;
1314
+ done = true;
1315
+ if (reconnectTimer) {
1316
+ clearTimeout(reconnectTimer);
1317
+ reconnectTimer = void 0;
1318
+ }
1319
+ if (abortController) {
1320
+ activeAbortControllers.delete(abortController);
1321
+ abortController.abort();
1322
+ abortController = void 0;
1323
+ }
1324
+ if (resolve) {
1325
+ resolve({ value: void 0, done: true });
1326
+ resolve = null;
1327
+ }
1328
+ return Promise.resolve({ value: void 0, done: true });
1329
+ },
1330
+ [Symbol.asyncIterator]() {
1331
+ return this;
1332
+ }
1333
+ };
1334
+ }
1335
+ };
1336
+ }
1337
+ };
1338
+
1339
+ exports.BillingClient = BillingClient;
1340
+ exports.EntitlementTier = EntitlementTier;
1341
+ exports.SubscriptionCycle = SubscriptionCycle;
1342
+ exports.SubscriptionProvider = SubscriptionProvider;
1343
+ exports.createHttpTransport = createHttpTransport;
1344
+ exports.print = print;
1345
+ //# sourceMappingURL=chunk-GDK2HJTF.cjs.map
1346
+ //# sourceMappingURL=chunk-GDK2HJTF.cjs.map