@dvina/sdk 4.1.59 → 4.1.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/_generated_documents-VM6RSSXR.js +1 -0
  2. package/dist/adapters/angular/index.d.ts +2 -2
  3. package/dist/adapters/angular/index.js +1 -159
  4. package/dist/adapters/react/index.js +1 -49
  5. package/dist/billing/index.js +1 -5
  6. package/dist/chunk-5E7LX4YQ.js +1 -0
  7. package/dist/chunk-D2L26FRK.js +5 -0
  8. package/dist/chunk-EK7ODJWE.js +1 -0
  9. package/dist/chunk-G34ETQUN.js +1 -0
  10. package/dist/chunk-H3TI6B7T.js +1 -0
  11. package/dist/chunk-IIQ3WGOJ.js +1 -0
  12. package/dist/chunk-IO56LXKJ.js +1 -0
  13. package/dist/chunk-SJ6Q5IDB.js +31 -0
  14. package/dist/{client-D309vpHA.d.ts → client-CEoJfTM9.d.ts} +2 -257
  15. package/dist/{index-fFR5so7x.d.ts → index-BzmzBgTh.d.ts} +1 -1
  16. package/dist/index.d.ts +7 -134
  17. package/dist/index.js +1 -10
  18. package/dist/inference/index.js +1 -5
  19. package/dist/package.json +12 -48
  20. package/dist/pagination/index.d.ts +2 -2
  21. package/dist/pagination/index.js +1 -5
  22. package/dist/{sync-engine-BIaOIpU3.d.ts → sync-engine-Bh0UcTVd.d.ts} +13 -0
  23. package/package.json +13 -49
  24. package/dist/_generated_documents-GHGFCEAV.js +0 -4
  25. package/dist/_generated_documents-GHGFCEAV.js.map +0 -1
  26. package/dist/_generated_documents-Z5MUI5BE.cjs +0 -2777
  27. package/dist/_generated_documents-Z5MUI5BE.cjs.map +0 -1
  28. package/dist/adapters/angular/index.cjs +0 -163
  29. package/dist/adapters/angular/index.cjs.map +0 -1
  30. package/dist/adapters/angular/index.d.cts +0 -254
  31. package/dist/adapters/angular/index.js.map +0 -1
  32. package/dist/adapters/react/index.cjs +0 -51
  33. package/dist/adapters/react/index.cjs.map +0 -1
  34. package/dist/adapters/react/index.d.cts +0 -62
  35. package/dist/adapters/react/index.js.map +0 -1
  36. package/dist/billing/index.cjs +0 -26
  37. package/dist/billing/index.cjs.map +0 -1
  38. package/dist/billing/index.d.cts +0 -328
  39. package/dist/billing/index.js.map +0 -1
  40. package/dist/chunk-2J5WONKO.cjs +0 -1608
  41. package/dist/chunk-2J5WONKO.cjs.map +0 -1
  42. package/dist/chunk-342BFYZZ.cjs +0 -98
  43. package/dist/chunk-342BFYZZ.cjs.map +0 -1
  44. package/dist/chunk-5WRI5ZAA.js +0 -29
  45. package/dist/chunk-5WRI5ZAA.js.map +0 -1
  46. package/dist/chunk-7XBJ77RJ.js +0 -103
  47. package/dist/chunk-7XBJ77RJ.js.map +0 -1
  48. package/dist/chunk-AE5KAIKK.js +0 -24
  49. package/dist/chunk-AE5KAIKK.js.map +0 -1
  50. package/dist/chunk-COFT5ZYL.js +0 -23777
  51. package/dist/chunk-COFT5ZYL.js.map +0 -1
  52. package/dist/chunk-DZUJEN5N.cjs +0 -32
  53. package/dist/chunk-DZUJEN5N.cjs.map +0 -1
  54. package/dist/chunk-FOKGSMXS.cjs +0 -27
  55. package/dist/chunk-FOKGSMXS.cjs.map +0 -1
  56. package/dist/chunk-HHBDJ65K.cjs +0 -24198
  57. package/dist/chunk-HHBDJ65K.cjs.map +0 -1
  58. package/dist/chunk-KEM6SUTS.js +0 -92
  59. package/dist/chunk-KEM6SUTS.js.map +0 -1
  60. package/dist/chunk-KSVHC4YE.cjs +0 -1841
  61. package/dist/chunk-KSVHC4YE.cjs.map +0 -1
  62. package/dist/chunk-KV5SP7RP.cjs +0 -114
  63. package/dist/chunk-KV5SP7RP.cjs.map +0 -1
  64. package/dist/chunk-NH4SMZCW.js +0 -1148
  65. package/dist/chunk-NH4SMZCW.js.map +0 -1
  66. package/dist/chunk-PDM2KR7T.js +0 -392
  67. package/dist/chunk-PDM2KR7T.js.map +0 -1
  68. package/dist/chunk-UELAE75E.cjs +0 -408
  69. package/dist/chunk-UELAE75E.cjs.map +0 -1
  70. package/dist/chunk-WX7EFPHT.js +0 -1600
  71. package/dist/chunk-WX7EFPHT.js.map +0 -1
  72. package/dist/client-BRIS6DdR.d.cts +0 -8159
  73. package/dist/client-Bb2gD6Iz.d.cts +0 -488
  74. package/dist/error-CsVoUTY8.d.cts +0 -95
  75. package/dist/index-D_Z25Pa1.d.cts +0 -79
  76. package/dist/index.cjs +0 -2039
  77. package/dist/index.cjs.map +0 -1
  78. package/dist/index.d.cts +0 -3823
  79. package/dist/index.js.map +0 -1
  80. package/dist/inference/index.cjs +0 -70
  81. package/dist/inference/index.cjs.map +0 -1
  82. package/dist/inference/index.d.cts +0 -80
  83. package/dist/inference/index.js.map +0 -1
  84. package/dist/pagination/index.cjs +0 -34
  85. package/dist/pagination/index.cjs.map +0 -1
  86. package/dist/pagination/index.d.cts +0 -6
  87. package/dist/pagination/index.js.map +0 -1
  88. package/dist/sync-engine-gpxyhQBl.d.cts +0 -478
  89. package/dist/types-Chg8ASmf.d.cts +0 -116
@@ -1,98 +0,0 @@
1
- 'use strict';
2
-
3
- // src/runtime/request.ts
4
- var Request = class {
5
- _request;
6
- _syncEngine;
7
- _subscribe;
8
- _baseUrl;
9
- constructor(request, syncEngine, subscribe, baseUrl) {
10
- this._request = request;
11
- this._syncEngine = syncEngine;
12
- this._subscribe = subscribe;
13
- this._baseUrl = baseUrl;
14
- }
15
- };
16
-
17
- // src/pagination/connection.ts
18
- var DEFAULT_PAGE_SIZE = 50;
19
- function defaultConnection(variables) {
20
- return {
21
- ...variables,
22
- first: variables.first ?? (variables.after ? DEFAULT_PAGE_SIZE : void 0),
23
- last: variables.last ?? (variables.before ? DEFAULT_PAGE_SIZE : void 0)
24
- };
25
- }
26
- var PageInfo = class {
27
- hasNextPage;
28
- hasPreviousPage;
29
- startCursor;
30
- endCursor;
31
- constructor(data) {
32
- this.hasNextPage = data.hasNextPage;
33
- this.hasPreviousPage = data.hasPreviousPage;
34
- this.startCursor = data.startCursor;
35
- this.endCursor = data.endCursor;
36
- }
37
- };
38
- var AbstractConnection = class extends Request {
39
- pageInfo;
40
- nodes;
41
- totalCount;
42
- constructor(request) {
43
- super(request);
44
- this.pageInfo = new PageInfo({
45
- hasNextPage: false,
46
- hasPreviousPage: false
47
- });
48
- this.nodes = [];
49
- }
50
- };
51
- var Connection = class extends AbstractConnection {
52
- _fetch;
53
- constructor(request, fetch, nodes, pageInfo, totalCount) {
54
- super(request);
55
- this._fetch = fetch;
56
- this.nodes = nodes;
57
- this.pageInfo = pageInfo;
58
- this.totalCount = totalCount;
59
- }
60
- /**
61
- * Fetch the next page and append nodes.
62
- * Mutates this connection instance in place (nodes are appended, pageInfo updated).
63
- */
64
- async fetchNext(options) {
65
- if (this.pageInfo.hasNextPage) {
66
- const response = await this._fetch({ after: this.pageInfo.endCursor }, options);
67
- if (response) {
68
- this.nodes = [...this.nodes, ...response.nodes];
69
- this.pageInfo.endCursor = response.pageInfo.endCursor ?? this.pageInfo.endCursor;
70
- this.pageInfo.hasNextPage = response.pageInfo.hasNextPage;
71
- }
72
- }
73
- return this;
74
- }
75
- /**
76
- * Fetch the previous page and prepend nodes.
77
- * Mutates this connection instance in place (nodes are prepended, pageInfo updated).
78
- */
79
- async fetchPrevious(options) {
80
- if (this.pageInfo.hasPreviousPage) {
81
- const response = await this._fetch({ before: this.pageInfo.startCursor }, options);
82
- if (response) {
83
- this.nodes = [...response.nodes, ...this.nodes];
84
- this.pageInfo.startCursor = response.pageInfo.startCursor ?? this.pageInfo.startCursor;
85
- this.pageInfo.hasPreviousPage = response.pageInfo.hasPreviousPage;
86
- }
87
- }
88
- return this;
89
- }
90
- };
91
-
92
- exports.AbstractConnection = AbstractConnection;
93
- exports.Connection = Connection;
94
- exports.PageInfo = PageInfo;
95
- exports.Request = Request;
96
- exports.defaultConnection = defaultConnection;
97
- //# sourceMappingURL=chunk-342BFYZZ.cjs.map
98
- //# sourceMappingURL=chunk-342BFYZZ.cjs.map
@@ -1 +0,0 @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AAA,MAAM,QAAA,GAAW,MAAM,IAAA,CAAK,MAAA,CAAO,EAAE,QAAQ,IAAA,CAAK,QAAA,CAAS,WAAA,EAAY,EAAG,OAAO,CAAA;AACjF,MAAA,IAAI,QAAA,EAAU;AACb,QAAA,IAAA,CAAK,QAAQ,CAAC,GAAG,SAAS,KAAA,EAAO,GAAG,KAAK,KAAK,CAAA;AAC9C,QAAA,IAAA,CAAK,SAAS,WAAA,GAAc,QAAA,CAAS,QAAA,CAAS,WAAA,IAAe,KAAK,QAAA,CAAS,WAAA;AAC3E,QAAA,IAAA,CAAK,QAAA,CAAS,eAAA,GAAkB,QAAA,CAAS,QAAA,CAAS,eAAA;AAAA,MACnD;AAAA,IACD;AACA,IAAA,OAAO,IAAA;AAAA,EACR;AACD","file":"chunk-342BFYZZ.cjs","sourcesContent":["import type { DvinaRequest, DvinaSubscribe } from '../types.js';\nimport type { SyncEngine } from '../store/sync-engine.js';\n\n/**\n * Base class that holds the transport functions.\n * Every generated model, connection, query, and the root SDK class extend this.\n *\n * Operation classes use `_syncEngine` for queries/mutations/watch.\n * Subscription classes use `_subscribe` for WebSocket streaming.\n * Model classes use `_request` for compatibility (lazy fetch).\n */\nexport class Request {\n\tprotected _request: DvinaRequest;\n\tprotected _syncEngine?: SyncEngine;\n\tprotected _subscribe?: DvinaSubscribe;\n\tprotected _baseUrl?: string;\n\n\tpublic constructor(request: DvinaRequest, syncEngine?: SyncEngine, subscribe?: DvinaSubscribe, baseUrl?: string) {\n\t\tthis._request = request;\n\t\tthis._syncEngine = syncEngine;\n\t\tthis._subscribe = subscribe;\n\t\tthis._baseUrl = baseUrl;\n\t}\n}\n","import { Request } from '../runtime/request.js';\nimport type { DvinaRequest, ConnectionVariables, FetchOptions, PageInfoData } from '../types.js';\n\n/** Default page size when cursor-paginating without an explicit first/last */\nconst DEFAULT_PAGE_SIZE = 50;\n\n/**\n * Default connection variables when paginating.\n * Ensures `first` or `last` is set when a cursor is provided.\n */\nexport function defaultConnection<V extends ConnectionVariables>(variables: V): V {\n\treturn {\n\t\t...variables,\n\t\tfirst: variables.first ?? (variables.after ? DEFAULT_PAGE_SIZE : undefined),\n\t\tlast: variables.last ?? (variables.before ? DEFAULT_PAGE_SIZE : undefined),\n\t};\n}\n\n/**\n * PageInfo model following the Relay spec.\n */\nexport class PageInfo {\n\tpublic hasNextPage: boolean;\n\tpublic hasPreviousPage: boolean;\n\tpublic startCursor?: string | null;\n\tpublic endCursor?: string | null;\n\n\tconstructor(data: PageInfoData) {\n\t\tthis.hasNextPage = data.hasNextPage;\n\t\tthis.hasPreviousPage = data.hasPreviousPage;\n\t\tthis.startCursor = data.startCursor;\n\t\tthis.endCursor = data.endCursor;\n\t}\n}\n\n/**\n * Abstract base class for connection types.\n * Holds nodes and page info, used for type checking.\n */\nexport abstract class AbstractConnection<Node> extends Request {\n\tpublic pageInfo: PageInfo;\n\tpublic nodes: Node[];\n\tpublic totalCount?: number;\n\n\tpublic constructor(request: DvinaRequest) {\n\t\tsuper(request);\n\t\tthis.pageInfo = new PageInfo({\n\t\t\thasNextPage: false,\n\t\t\thasPreviousPage: false,\n\t\t});\n\t\tthis.nodes = [];\n\t}\n}\n\n/**\n * Concrete connection class with pagination helpers.\n * Generated connection subclasses extend this.\n *\n * The `_fetch` closure is created by the query class and allows re-fetching\n * with different pagination variables.\n */\nexport class Connection<Node> extends AbstractConnection<Node> {\n\tprivate _fetch: (variables?: ConnectionVariables, options?: FetchOptions) => Promise<Connection<Node> | undefined>;\n\n\tpublic constructor(\n\t\trequest: DvinaRequest,\n\t\tfetch: (variables?: ConnectionVariables, options?: FetchOptions) => Promise<Connection<Node> | undefined>,\n\t\tnodes: Node[],\n\t\tpageInfo: PageInfo,\n\t\ttotalCount?: number,\n\t) {\n\t\tsuper(request);\n\t\tthis._fetch = fetch;\n\t\tthis.nodes = nodes;\n\t\tthis.pageInfo = pageInfo;\n\t\tthis.totalCount = totalCount;\n\t}\n\n\t/**\n\t * Fetch the next page and append nodes.\n\t * Mutates this connection instance in place (nodes are appended, pageInfo updated).\n\t */\n\tpublic async fetchNext(options?: FetchOptions): Promise<this> {\n\t\tif (this.pageInfo.hasNextPage) {\n\t\t\tconst response = await this._fetch({ after: this.pageInfo.endCursor }, options);\n\t\t\tif (response) {\n\t\t\t\tthis.nodes = [...this.nodes, ...response.nodes];\n\t\t\t\tthis.pageInfo.endCursor = response.pageInfo.endCursor ?? this.pageInfo.endCursor;\n\t\t\t\tthis.pageInfo.hasNextPage = response.pageInfo.hasNextPage;\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Fetch the previous page and prepend nodes.\n\t * Mutates this connection instance in place (nodes are prepended, pageInfo updated).\n\t */\n\tpublic async fetchPrevious(options?: FetchOptions): Promise<this> {\n\t\tif (this.pageInfo.hasPreviousPage) {\n\t\t\tconst response = await this._fetch({ before: this.pageInfo.startCursor }, options);\n\t\t\tif (response) {\n\t\t\t\tthis.nodes = [...response.nodes, ...this.nodes];\n\t\t\t\tthis.pageInfo.startCursor = response.pageInfo.startCursor ?? this.pageInfo.startCursor;\n\t\t\t\tthis.pageInfo.hasPreviousPage = response.pageInfo.hasPreviousPage;\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n}\n"]}
@@ -1,29 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
- // If the importer is in node compatibility mode or this is not an ESM
20
- // file that has been converted to a CommonJS file using a Babel-
21
- // compatible transform (i.e. "__esModule" has not been set), then set
22
- // "default" to the CommonJS "module.exports" for node compatibility.
23
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
- mod
25
- ));
26
-
27
- export { __commonJS, __toESM };
28
- //# sourceMappingURL=chunk-5WRI5ZAA.js.map
29
- //# sourceMappingURL=chunk-5WRI5ZAA.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-5WRI5ZAA.js"}
@@ -1,103 +0,0 @@
1
- // src/error.ts
2
- var DvinaError = class extends Error {
3
- /** The original error, if any */
4
- cause;
5
- constructor(message, cause) {
6
- super(message);
7
- this.name = "DvinaError";
8
- this.cause = cause;
9
- }
10
- };
11
- var DvinaGraphQLError = class extends DvinaError {
12
- /** The raw GraphQL errors array */
13
- errors;
14
- /** The query that caused the error (for debugging) */
15
- query;
16
- /** The variables that were passed */
17
- variables;
18
- constructor(errors, query, variables) {
19
- const message = errors.map((e) => e.message).join("; ") || "Unknown GraphQL error";
20
- super(message);
21
- this.name = "DvinaGraphQLError";
22
- this.errors = errors;
23
- this.query = query;
24
- this.variables = variables;
25
- }
26
- };
27
- var DvinaNetworkError = class extends DvinaError {
28
- /** HTTP status code, if available */
29
- status;
30
- constructor(message, status, cause) {
31
- super(message, cause);
32
- this.name = "DvinaNetworkError";
33
- this.status = status;
34
- }
35
- };
36
- var DvinaAuthenticationError = class extends DvinaError {
37
- /** The token that was used when the auth error occurred (for stale-token detection). */
38
- failedToken;
39
- constructor(message = "Authentication failed", failedTokenOrCause, cause) {
40
- super(message, typeof failedTokenOrCause === "string" ? cause : failedTokenOrCause);
41
- this.name = "DvinaAuthenticationError";
42
- this.failedToken = typeof failedTokenOrCause === "string" ? failedTokenOrCause : void 0;
43
- }
44
- };
45
- var GRAPHQL_ERROR_CODES = {
46
- SESSION_TOKEN_LIMIT_REACHED: "SESSION_TOKEN_LIMIT_REACHED",
47
- STORAGE_LIMIT_REACHED: "STORAGE_LIMIT_REACHED",
48
- DEEP_ANALYSIS_LIMIT_EXCEEDED: "DEEP_ANALYSIS_LIMIT_EXCEEDED",
49
- PLAN_DETAIL_RESTRICTION: "PLAN_DETAIL_RESTRICTION",
50
- RESOURCE_NOT_FOUND: "RESOURCE_NOT_FOUND"
51
- };
52
- var PLAN_RESTRICTION_CODES = /* @__PURE__ */ new Set([
53
- GRAPHQL_ERROR_CODES.PLAN_DETAIL_RESTRICTION,
54
- GRAPHQL_ERROR_CODES.STORAGE_LIMIT_REACHED,
55
- GRAPHQL_ERROR_CODES.DEEP_ANALYSIS_LIMIT_EXCEEDED
56
- ]);
57
- var DvinaPlanRestrictionError = class extends DvinaGraphQLError {
58
- /** The specific restriction code (e.g. 'PLAN_DETAIL_RESTRICTION') */
59
- restrictionCode;
60
- constructor(errors, restrictionCode, query, variables) {
61
- super(errors, query, variables);
62
- this.name = "DvinaPlanRestrictionError";
63
- this.restrictionCode = restrictionCode;
64
- }
65
- };
66
- var DvinaTokenLimitError = class extends DvinaGraphQLError {
67
- constructor(errors, query, variables) {
68
- super(errors, query, variables);
69
- this.name = "DvinaTokenLimitError";
70
- }
71
- };
72
- var DvinaNotFoundError = class extends DvinaGraphQLError {
73
- constructor(errors, query, variables) {
74
- super(errors, query, variables);
75
- this.name = "DvinaNotFoundError";
76
- }
77
- };
78
- function extractErrorCode(errors) {
79
- for (const err of errors) {
80
- const raw = err.extensions?.["code"];
81
- if (raw !== void 0 && raw !== null) {
82
- return String(raw).toUpperCase();
83
- }
84
- }
85
- return void 0;
86
- }
87
- function createGraphQLError(errors, query, variables) {
88
- const code = extractErrorCode(errors);
89
- if (code === GRAPHQL_ERROR_CODES.SESSION_TOKEN_LIMIT_REACHED) {
90
- return new DvinaTokenLimitError(errors, query, variables);
91
- }
92
- if (code === GRAPHQL_ERROR_CODES.RESOURCE_NOT_FOUND) {
93
- return new DvinaNotFoundError(errors, query, variables);
94
- }
95
- if (code && PLAN_RESTRICTION_CODES.has(code)) {
96
- return new DvinaPlanRestrictionError(errors, code, query, variables);
97
- }
98
- return new DvinaGraphQLError(errors, query, variables);
99
- }
100
-
101
- export { DvinaAuthenticationError, DvinaError, DvinaGraphQLError, DvinaNetworkError, DvinaNotFoundError, DvinaPlanRestrictionError, DvinaTokenLimitError, GRAPHQL_ERROR_CODES, createGraphQLError, extractErrorCode };
102
- //# sourceMappingURL=chunk-7XBJ77RJ.js.map
103
- //# sourceMappingURL=chunk-7XBJ77RJ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/error.ts"],"names":[],"mappings":";AAGO,IAAM,UAAA,GAAN,cAAyB,KAAA,CAAM;AAAA;AAAA,EAErB,KAAA;AAAA,EAEhB,WAAA,CAAY,SAAiB,KAAA,EAAe;AAC3C,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,YAAA;AACZ,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA;AAAA,EACd;AACD;AAKO,IAAM,iBAAA,GAAN,cAAgC,UAAA,CAAW;AAAA;AAAA,EAEjC,MAAA;AAAA;AAAA,EAEA,KAAA;AAAA;AAAA,EAEA,SAAA;AAAA,EAEhB,WAAA,CAAY,MAAA,EAAsC,KAAA,EAAgB,SAAA,EAAqC;AACtG,IAAA,MAAM,OAAA,GAAU,MAAA,CAAO,GAAA,CAAI,CAAC,CAAA,KAAM,EAAE,OAAO,CAAA,CAAE,IAAA,CAAK,IAAI,CAAA,IAAK,uBAAA;AAC3D,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,mBAAA;AACZ,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,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oB,kBAAA,EAAoB;AACpD,IAAA,OAAO,IAAI,kBAAA,CAAmB,MAAA,EAAQ,KAAA,EAAO,SAAS,CAAA;AAAA,EACvD;AAEA,EAAA,IAAI,IAAA,IAAQ,sBAAA,CAAuB,GAAA,CAAI,IAAI,CAAA,EAAG;AAC7C,IAAA,OAAO,IAAI,yBAAA,CAA0B,MAAA,EAAQ,IAAA,EAAM,OAAO,SAAS,CAAA;AAAA,EACpE;AAEA,EAAA,OAAO,IAAI,iBAAA,CAAkB,MAAA,EAAQ,KAAA,EAAO,SAAS,CAAA;AACtD","file":"chunk-7XBJ77RJ.js","sourcesContent":["/**\n * Base error class for all Dvina SDK errors.\n */\nexport class DvinaError extends Error {\n\t/** The original error, if any */\n\tpublic readonly cause?: Error;\n\n\tconstructor(message: string, cause?: Error) {\n\t\tsuper(message);\n\t\tthis.name = 'DvinaError';\n\t\tthis.cause = cause;\n\t}\n}\n\n/**\n * Error thrown when the GraphQL response contains errors.\n */\nexport class DvinaGraphQLError extends DvinaError {\n\t/** The raw GraphQL errors array */\n\tpublic readonly errors: readonly GraphQLErrorEntry[];\n\t/** The query that caused the error (for debugging) */\n\tpublic readonly query?: string;\n\t/** The variables that were passed */\n\tpublic readonly variables?: Record<string, unknown>;\n\n\tconstructor(errors: readonly GraphQLErrorEntry[], query?: string, variables?: Record<string, unknown>) {\n\t\tconst message = errors.map((e) => e.message).join('; ') || 'Unknown GraphQL error';\n\t\tsuper(message);\n\t\tthis.name = 'DvinaGraphQLError';\n\t\tthis.errors = errors;\n\t\tthis.query = query;\n\t\tthis.variables = variables;\n\t}\n}\n\n/**\n * Error thrown on network failures (connection refused, timeout, etc.)\n */\nexport class DvinaNetworkError extends DvinaError {\n\t/** HTTP status code, if available */\n\tpublic readonly status?: number;\n\n\tconstructor(message: string, status?: number, cause?: Error) {\n\t\tsuper(message, cause);\n\t\tthis.name = 'DvinaNetworkError';\n\t\tthis.status = status;\n\t}\n}\n\n/**\n * Error thrown when authentication fails (401/403).\n */\nexport class DvinaAuthenticationError extends DvinaError {\n\t/** The token that was used when the auth error occurred (for stale-token detection). */\n\tpublic readonly failedToken?: string;\n\n\tconstructor(message = 'Authentication failed', failedTokenOrCause?: string | Error, cause?: Error) {\n\t\tsuper(message, typeof failedTokenOrCause === 'string' ? cause : failedTokenOrCause);\n\t\tthis.name = 'DvinaAuthenticationError';\n\t\tthis.failedToken = typeof failedTokenOrCause === 'string' ? failedTokenOrCause : undefined;\n\t}\n}\n\n// ─── GraphQL Business Error Codes ────────────────────────────────────────────\n\n/**\n * Known GraphQL error codes returned by the Dvina API in `extensions.code`.\n * Used for programmatic matching in SDK error detection.\n */\nexport const GRAPHQL_ERROR_CODES = {\n\tSESSION_TOKEN_LIMIT_REACHED: 'SESSION_TOKEN_LIMIT_REACHED',\n\tSTORAGE_LIMIT_REACHED: 'STORAGE_LIMIT_REACHED',\n\tDEEP_ANALYSIS_LIMIT_EXCEEDED: 'DEEP_ANALYSIS_LIMIT_EXCEEDED',\n\tPLAN_DETAIL_RESTRICTION: 'PLAN_DETAIL_RESTRICTION',\n\tRESOURCE_NOT_FOUND: 'RESOURCE_NOT_FOUND',\n} as const;\n\n/** Codes that indicate a plan/billing restriction. */\nconst PLAN_RESTRICTION_CODES = new Set<string>([\n\tGRAPHQL_ERROR_CODES.PLAN_DETAIL_RESTRICTION,\n\tGRAPHQL_ERROR_CODES.STORAGE_LIMIT_REACHED,\n\tGRAPHQL_ERROR_CODES.DEEP_ANALYSIS_LIMIT_EXCEEDED,\n]);\n\n// ─── GraphQL Business Error Subclasses ───────────────────────────────────────\n\n/**\n * Base class for plan/billing restriction errors.\n * Thrown when the workspace exceeds a plan limit (storage, capabilities, deep analysis).\n *\n * Consumers can `catch (e) { if (e instanceof DvinaPlanRestrictionError) showUpgradeDialog(); }`\n */\nexport class DvinaPlanRestrictionError extends DvinaGraphQLError {\n\t/** The specific restriction code (e.g. 'PLAN_DETAIL_RESTRICTION') */\n\tpublic readonly restrictionCode: string;\n\n\tconstructor(\n\t\terrors: readonly GraphQLErrorEntry[],\n\t\trestrictionCode: string,\n\t\tquery?: string,\n\t\tvariables?: Record<string, unknown>,\n\t) {\n\t\tsuper(errors, query, variables);\n\t\tthis.name = 'DvinaPlanRestrictionError';\n\t\tthis.restrictionCode = restrictionCode;\n\t}\n}\n\n/**\n * Error thrown when the chat session token limit is reached (SESSION_TOKEN_LIMIT_REACHED).\n * Distinct from inference quota — this is a per-session GraphQL limit.\n */\nexport class DvinaTokenLimitError extends DvinaGraphQLError {\n\tconstructor(errors: readonly GraphQLErrorEntry[], query?: string, variables?: Record<string, unknown>) {\n\t\tsuper(errors, query, variables);\n\t\tthis.name = 'DvinaTokenLimitError';\n\t}\n}\n\n/**\n * Error thrown when a requested resource is not found (RESOURCE_NOT_FOUND).\n */\nexport class DvinaNotFoundError extends DvinaGraphQLError {\n\tconstructor(errors: readonly GraphQLErrorEntry[], query?: string, variables?: Record<string, unknown>) {\n\t\tsuper(errors, query, variables);\n\t\tthis.name = 'DvinaNotFoundError';\n\t}\n}\n\n// ─── Error Detection Helpers ─────────────────────────────────────────────────\n\n/**\n * Extract the first extension code from a list of GraphQL errors (normalized to uppercase).\n * Returns `undefined` if no code is present.\n */\nexport function extractErrorCode(errors: readonly GraphQLErrorEntry[]): string | undefined {\n\tfor (const err of errors) {\n\t\tconst raw = err.extensions?.['code'];\n\t\tif (raw !== undefined && raw !== null) {\n\t\t\treturn String(raw).toUpperCase();\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/**\n * Create the appropriate `DvinaGraphQLError` subclass for the given errors,\n * or return a generic `DvinaGraphQLError` if no specific match is found.\n */\nexport function createGraphQLError(\n\terrors: readonly GraphQLErrorEntry[],\n\tquery?: string,\n\tvariables?: Record<string, unknown>,\n): DvinaGraphQLError {\n\tconst code = extractErrorCode(errors);\n\n\tif (code === GRAPHQL_ERROR_CODES.SESSION_TOKEN_LIMIT_REACHED) {\n\t\treturn new DvinaTokenLimitError(errors, query, variables);\n\t}\n\n\tif (code === GRAPHQL_ERROR_CODES.RESOURCE_NOT_FOUND) {\n\t\treturn new DvinaNotFoundError(errors, query, variables);\n\t}\n\n\tif (code && PLAN_RESTRICTION_CODES.has(code)) {\n\t\treturn new DvinaPlanRestrictionError(errors, code, query, variables);\n\t}\n\n\treturn new DvinaGraphQLError(errors, query, variables);\n}\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\n/**\n * Shape of a single GraphQL error in the response.\n */\nexport interface GraphQLErrorEntry {\n\tmessage: string;\n\tlocations?: readonly { line: number; column: number }[];\n\tpath?: readonly (string | number)[];\n\textensions?: Record<string, unknown>;\n}\n"]}
@@ -1,24 +0,0 @@
1
- import { Connection, PageInfo } from './chunk-KEM6SUTS.js';
2
-
3
- // src/pagination/helpers.ts
4
- function extractNodes(connection) {
5
- return connection.nodes;
6
- }
7
- function mergeConnections(first, second) {
8
- return new Connection(
9
- first._request,
10
- second._fetch,
11
- [...first.nodes, ...second.nodes],
12
- new PageInfo({
13
- hasNextPage: second.pageInfo.hasNextPage,
14
- hasPreviousPage: first.pageInfo.hasPreviousPage,
15
- startCursor: first.pageInfo.startCursor,
16
- endCursor: second.pageInfo.endCursor
17
- }),
18
- second.totalCount ?? first.totalCount
19
- );
20
- }
21
-
22
- export { extractNodes, mergeConnections };
23
- //# sourceMappingURL=chunk-AE5KAIKK.js.map
24
- //# sourceMappingURL=chunk-AE5KAIKK.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/pagination/helpers.ts"],"names":[],"mappings":";;;AAKO,SAAS,aAAgB,UAAA,EAAgC;AAC/D,EAAA,OAAO,UAAA,CAAW,KAAA;AACnB;AAQO,SAAS,gBAAA,CAAoB,OAAsB,MAAA,EAAsC;AAC/F,EAAA,OAAO,IAAI,UAAA;AAAA,IACT,KAAA,CAAc,QAAA;AAAA,IACd,MAAA,CAAe,MAAA;AAAA,IAChB,CAAC,GAAG,KAAA,CAAM,KAAA,EAAO,GAAG,OAAO,KAAK,CAAA;AAAA,IAChC,IAAI,QAAA,CAAS;AAAA,MACZ,WAAA,EAAa,OAAO,QAAA,CAAS,WAAA;AAAA,MAC7B,eAAA,EAAiB,MAAM,QAAA,CAAS,eAAA;AAAA,MAChC,WAAA,EAAa,MAAM,QAAA,CAAS,WAAA;AAAA,MAC5B,SAAA,EAAW,OAAO,QAAA,CAAS;AAAA,KAC3B,CAAA;AAAA,IACD,MAAA,CAAO,cAAc,KAAA,CAAM;AAAA,GAC5B;AACD","file":"chunk-AE5KAIKK.js","sourcesContent":["import { PageInfo, Connection } from './connection.js';\n\n/**\n * Extract all nodes from a connection.\n */\nexport function extractNodes<T>(connection: Connection<T>): T[] {\n\treturn connection.nodes;\n}\n\n/**\n * Merge two connections into a new connection. Appends the second connection's\n * nodes after the first's. Uses the second connection's end cursor and hasNextPage.\n *\n * Neither input connection is modified.\n */\nexport function mergeConnections<T>(first: Connection<T>, second: Connection<T>): Connection<T> {\n\treturn new Connection<T>(\n\t\t(first as any)._request,\n\t\t(second as any)._fetch,\n\t\t[...first.nodes, ...second.nodes],\n\t\tnew PageInfo({\n\t\t\thasNextPage: second.pageInfo.hasNextPage,\n\t\t\thasPreviousPage: first.pageInfo.hasPreviousPage,\n\t\t\tstartCursor: first.pageInfo.startCursor,\n\t\t\tendCursor: second.pageInfo.endCursor,\n\t\t}),\n\t\tsecond.totalCount ?? first.totalCount,\n\t);\n}\n"]}