@dvina/sdk 4.1.112 → 4.1.173

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 (38) hide show
  1. package/README.md +37 -134
  2. package/dist/_generated_documents-6WGCKLGZ.js +1 -0
  3. package/dist/_generated_sdk-7_X86mtI.d.ts +17341 -0
  4. package/dist/adapters/react/index.d.ts +36 -24
  5. package/dist/adapters/react/index.js +1 -1
  6. package/dist/ai/index.d.ts +570 -0
  7. package/dist/ai/index.js +3 -0
  8. package/dist/billing/index.d.ts +43 -15
  9. package/dist/billing/index.js +1 -1
  10. package/dist/chunk-32KGDH2Q.js +1 -0
  11. package/dist/chunk-37LLNIGO.js +1 -0
  12. package/dist/chunk-OCM5W3JH.js +1 -0
  13. package/dist/chunk-W764PDVJ.js +31 -0
  14. package/dist/chunk-Z2ADTQ64.js +1 -0
  15. package/dist/{sync-engine-DYHreGOv.d.ts → connection-ClMdDUce.d.ts} +223 -11
  16. package/dist/{error-CsVoUTY8.d.ts → error-Bk0Jmuzd.d.ts} +11 -3
  17. package/dist/index.d.ts +24 -3563
  18. package/dist/index.js +4 -1
  19. package/dist/package.json +8 -13
  20. package/dist/pagination/index.d.ts +18 -4
  21. package/dist/pagination/index.js +1 -1
  22. package/dist/{types-Chg8ASmf.d.ts → types-BfiQdtra.d.ts} +1 -9
  23. package/package.json +26 -21
  24. package/dist/_generated_documents-54JPKRBN.js +0 -1
  25. package/dist/adapters/angular/index.d.ts +0 -254
  26. package/dist/adapters/angular/index.js +0 -1
  27. package/dist/chunk-5E7LX4YQ.js +0 -1
  28. package/dist/chunk-G34ETQUN.js +0 -1
  29. package/dist/chunk-H3TI6B7T.js +0 -1
  30. package/dist/chunk-IFSDIGN6.js +0 -1
  31. package/dist/chunk-IIQ3WGOJ.js +0 -1
  32. package/dist/chunk-QNQ3WSMR.js +0 -5
  33. package/dist/chunk-YUQTEBYO.js +0 -31
  34. package/dist/client-Bb2gD6Iz.d.ts +0 -488
  35. package/dist/client-Bqi7gjM0.d.ts +0 -7987
  36. package/dist/index-DoGg4ya_.d.ts +0 -79
  37. package/dist/inference/index.d.ts +0 -80
  38. package/dist/inference/index.js +0 -1
package/dist/package.json CHANGED
@@ -8,10 +8,6 @@
8
8
  "types": "./index.d.ts",
9
9
  "default": "./index.js"
10
10
  },
11
- "./angular": {
12
- "types": "./adapters/angular/index.d.ts",
13
- "default": "./adapters/angular/index.js"
14
- },
15
11
  "./react": {
16
12
  "types": "./adapters/react/index.d.ts",
17
13
  "default": "./adapters/react/index.js"
@@ -20,30 +16,29 @@
20
16
  "types": "./pagination/index.d.ts",
21
17
  "default": "./pagination/index.js"
22
18
  },
23
- "./inference": {
24
- "types": "./inference/index.d.ts",
25
- "default": "./inference/index.js"
26
- },
27
19
  "./billing": {
28
20
  "types": "./billing/index.d.ts",
29
21
  "default": "./billing/index.js"
22
+ },
23
+ "./ai": {
24
+ "types": "./ai/index.d.ts",
25
+ "default": "./ai/index.js"
30
26
  }
31
27
  },
32
28
  "dependencies": {
33
29
  "@graphql-typed-document-node/core": "^3.2.0",
34
30
  "dexie": "^4.3.0",
35
- "graphql": "^16.9.0",
36
- "graphql-ws": "^6.0.0"
31
+ "graphql": "^16.9.0"
37
32
  },
38
33
  "peerDependencies": {
39
- "@angular/core": ">=19.0.0",
34
+ "ai": "^7.0.0",
40
35
  "react": ">=18.0.0"
41
36
  },
42
37
  "peerDependenciesMeta": {
43
- "@angular/core": {
38
+ "react": {
44
39
  "optional": true
45
40
  },
46
- "react": {
41
+ "ai": {
47
42
  "optional": true
48
43
  }
49
44
  }
@@ -1,6 +1,20 @@
1
- export { A as AbstractConnection, C as Connection, P as PageInfo, d as defaultConnection, e as extractNodes, m as mergeConnections } from '../index-DoGg4ya_.js';
2
- import '../types-Chg8ASmf.js';
1
+ import { f as Connection } from '../connection-ClMdDUce.js';
2
+ export { A as AbstractConnection, P as PageInfo, r as defaultConnection } from '../connection-ClMdDUce.js';
3
+ import '../types-BfiQdtra.js';
3
4
  import 'graphql';
4
- import '../sync-engine-DYHreGOv.js';
5
5
  import 'dexie';
6
- import '../error-CsVoUTY8.js';
6
+ import '../error-Bk0Jmuzd.js';
7
+
8
+ /**
9
+ * Extract all nodes from a connection.
10
+ */
11
+ declare function extractNodes<T>(connection: Connection<T>): T[];
12
+ /**
13
+ * Merge two connections into a new connection. Appends the second connection's
14
+ * nodes after the first's. Uses the second connection's end cursor and hasNextPage.
15
+ *
16
+ * Neither input connection is modified.
17
+ */
18
+ declare function mergeConnections<T>(first: Connection<T>, second: Connection<T>): Connection<T>;
19
+
20
+ export { Connection, extractNodes, mergeConnections };
@@ -1 +1 @@
1
- export{a as extractNodes,b as mergeConnections}from'../chunk-G34ETQUN.js';export{d as AbstractConnection,e as Connection,c as PageInfo,b as defaultConnection}from'../chunk-H3TI6B7T.js';import'../chunk-EK7ODJWE.js';
1
+ export{d as AbstractConnection,e as Connection,c as PageInfo,b as defaultConnection,f as extractNodes,g as mergeConnections}from'../chunk-OCM5W3JH.js';import'../chunk-EK7ODJWE.js';
@@ -22,14 +22,6 @@ interface MutationOptions {
22
22
  * @template T - The expected response data shape
23
23
  */
24
24
  type DvinaRequest = <T>(document: DocumentNode, variables?: Record<string, unknown>, options?: FetchOptions) => Promise<T>;
25
- /**
26
- * Subscription transport abstraction.
27
- * Returns an `AsyncIterable` that yields values as the server pushes them
28
- * over WebSocket (graphql-ws protocol).
29
- *
30
- * @template T - The expected payload shape per emission
31
- */
32
- type DvinaSubscribe = <T>(document: DocumentNode, variables?: Record<string, unknown>) => AsyncIterable<T>;
33
25
  /**
34
26
  * Store-reactive query reference. Implements `AsyncIterable` so it can be consumed
35
27
  * with `for await...of` in any JavaScript environment, and converted to framework
@@ -113,4 +105,4 @@ interface PageInfoData {
113
105
  endCursor?: string | null;
114
106
  }
115
107
 
116
- export type { ConnectionVariables as C, DvinaAsyncRef as D, FetchOptions as F, MutationOptions as M, PageInfoData as P, WithIncludes as W, DvinaQueryRef as a, DvinaRequest as b, DvinaSubscribe as c, ConnectionWithNodes as d };
108
+ export type { ConnectionVariables as C, DvinaQueryRef as D, FetchOptions as F, MutationOptions as M, PageInfoData as P, WithIncludes as W, ConnectionWithNodes as a, DvinaAsyncRef as b, DvinaRequest as c };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dvina/sdk",
3
- "version": "4.1.112",
3
+ "version": "4.1.173",
4
4
  "description": "Type-safe SDK for the Dvina GraphQL API",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
@@ -9,10 +9,6 @@
9
9
  "types": "./dist/index.d.ts",
10
10
  "default": "./dist/index.js"
11
11
  },
12
- "./angular": {
13
- "types": "./dist/adapters/angular/index.d.ts",
14
- "default": "./dist/adapters/angular/index.js"
15
- },
16
12
  "./react": {
17
13
  "types": "./dist/adapters/react/index.d.ts",
18
14
  "default": "./dist/adapters/react/index.js"
@@ -21,13 +17,13 @@
21
17
  "types": "./dist/pagination/index.d.ts",
22
18
  "default": "./dist/pagination/index.js"
23
19
  },
24
- "./inference": {
25
- "types": "./dist/inference/index.d.ts",
26
- "default": "./dist/inference/index.js"
27
- },
28
20
  "./billing": {
29
21
  "types": "./dist/billing/index.d.ts",
30
22
  "default": "./dist/billing/index.js"
23
+ },
24
+ "./ai": {
25
+ "types": "./dist/ai/index.d.ts",
26
+ "default": "./dist/ai/index.js"
31
27
  }
32
28
  },
33
29
  "files": [
@@ -35,6 +31,7 @@
35
31
  ],
36
32
  "scripts": {
37
33
  "build": "tsup",
34
+ "build:swap": "node scripts/build-swap.mjs",
38
35
  "build:codegen": "pnpm --filter @dvina/codegen-doc run build && pnpm --filter @dvina/codegen-sdk run build && pnpm --filter @dvina/codegen-test run build",
39
36
  "build:workspace": "pnpm run generate:workspace && pnpm run build",
40
37
  "build:types": "tsc --noEmit",
@@ -43,11 +40,12 @@
43
40
  "generate:sdk": "graphql-codegen --config codegen.sdk.yml",
44
41
  "generate:sdk:standalone": "tsx codegen/codegen-sdk/src/generate.ts",
45
42
  "generate:billing": "graphql-codegen --config codegen.billing.yml",
43
+ "generate:messages": "node scripts/generate-messages.mjs",
46
44
  "generate:test": "graphql-codegen --config codegen.test.yml",
47
- "generate": "pnpm run generate:doc && pnpm run generate:sdk && pnpm run generate:billing && pnpm run generate:test",
45
+ "generate": "pnpm run generate:doc && pnpm run generate:sdk && pnpm run generate:billing && pnpm run generate:messages && pnpm run generate:test",
48
46
  "generate:workspace": "pnpm run build:codegen && pnpm run generate",
49
47
  "test": "vitest run",
50
- "lint": "eslint src/**/*.ts",
48
+ "lint": "eslint src",
51
49
  "type-check": "tsc --noEmit"
52
50
  },
53
51
  "keywords": [
@@ -61,26 +59,23 @@
61
59
  "author": "Dvina Inc.",
62
60
  "license": "MIT",
63
61
  "peerDependencies": {
64
- "@angular/core": ">=19.0.0",
62
+ "ai": "^7.0.0",
65
63
  "react": ">=18.0.0"
66
64
  },
67
65
  "peerDependenciesMeta": {
68
- "@angular/core": {
66
+ "react": {
69
67
  "optional": true
70
68
  },
71
- "react": {
69
+ "ai": {
72
70
  "optional": true
73
71
  }
74
72
  },
75
73
  "dependencies": {
76
74
  "@graphql-typed-document-node/core": "^3.2.0",
77
75
  "dexie": "^4.3.0",
78
- "graphql": "^16.9.0",
79
- "graphql-ws": "^6.0.0"
76
+ "graphql": "^16.9.0"
80
77
  },
81
78
  "devDependencies": {
82
- "@angular/core": "22.1.5",
83
- "@apollo/client": "^3.11.0",
84
79
  "@dvina/codegen-doc": "workspace:*",
85
80
  "@dvina/codegen-sdk": "workspace:*",
86
81
  "@dvina/codegen-test": "workspace:*",
@@ -90,18 +85,28 @@
90
85
  "@graphql-codegen/typescript": "^2.8.0",
91
86
  "@graphql-codegen/typescript-operations": "^2.5.0",
92
87
  "@graphql-codegen/visitor-plugin-common": "^2.13.0",
93
- "@types/node": "^20.11.16",
94
- "@types/react": "^19.2.14",
95
88
  "@graphql-tools/mock": "^9.0.0",
96
89
  "@graphql-tools/schema": "^10.0.0",
90
+ "@types/node": "^20.11.16",
91
+ "@types/react": "^19.2.14",
92
+ "ai": "^7.0.128",
93
+ "eslint": "^9.39.5",
94
+ "eslint-config-prettier": "^10.1.8",
95
+ "eslint-plugin-react-hooks": "^7.1.1",
97
96
  "fake-indexeddb": "^6.0.0",
98
97
  "get-port": "^7.1.0",
99
- "react": "^19.2.4",
98
+ "react": "^19.3.0",
100
99
  "tsup": "^8.0.2",
101
100
  "typescript": "^5.3.3",
101
+ "typescript-eslint": "^8.71.0",
102
102
  "vitest": "^4.0.17"
103
103
  },
104
104
  "publishConfig": {
105
105
  "access": "public"
106
+ },
107
+ "repository": {
108
+ "type": "git",
109
+ "url": "git+https://github.com/kantist/dvina.git",
110
+ "directory": "projects/sdk"
106
111
  }
107
112
  }
@@ -1 +0,0 @@
1
- export{Qg as AbortChatDocument,na as ActionAvgAggregateFragmentDoc,oa as ActionCountAggregateFragmentDoc,ma as ActionFragmentDoc,pa as ActionMaxAggregateFragmentDoc,qa as ActionMinAggregateFragmentDoc,ra as ActionSumAggregateFragmentDoc,b as ActionType,c as ActiveWindowType,Rg as AddInsightToReportDocument,Sg as AddMcpServerDocument,ta as AgentConnectionFragmentDoc,ua as AgentCountAggregateFragmentDoc,wi as AgentDocument,sa as AgentFragmentDoc,va as AgentMaxAggregateFragmentDoc,wa as AgentMinAggregateFragmentDoc,d as AgentOrderByRelevanceFieldEnum,xi as Agent_ChatsDocument,yi as AgentsDocument,zi as AiProviderSettingDocument,a as AiResourceType,ya as ArtifactConnectionFragmentDoc,za as ArtifactCountAggregateFragmentDoc,Ai as ArtifactDocument,xa as ArtifactFragmentDoc,e as ArtifactKind,Aa as ArtifactMaxAggregateFragmentDoc,Ba as ArtifactMinAggregateFragmentDoc,f as ArtifactOrderByRelevanceFieldEnum,Bi as Artifact_ChatDocument,Ci as Artifact_Chat_DesktopDeviceDocument,Di as Artifact_Chat_InsightDocument,Ei as Artifact_Chat_ProjectDocument,Fi as Artifact_FileDocument,Gi as Artifact_MessageDocument,Hi as Artifact_Message_ChatDocument,Ii as Artifact_Message_ContentsDocument,Ji as Artifact_Message_FeedbackDocument,Ki as ArtifactsDocument,zf as AudioEventOutputFragmentDoc,Tg as CancelOauthFlowDocument,Ug as CancelWorkspaceDeletionDocument,Da as CandidateAvgAggregateFragmentDoc,Ea as CandidateCountAggregateFragmentDoc,Ga as CandidateEvidenceCountAggregateFragmentDoc,Fa as CandidateEvidenceFragmentDoc,Ha as CandidateEvidenceMaxAggregateFragmentDoc,Ia as CandidateEvidenceMinAggregateFragmentDoc,Ca as CandidateFragmentDoc,Ka as CandidateGenerationRejectionCountAggregateFragmentDoc,Ja as CandidateGenerationRejectionFragmentDoc,La as CandidateGenerationRejectionMaxAggregateFragmentDoc,Ma as CandidateGenerationRejectionMinAggregateFragmentDoc,Oa as CandidateGenerationRejectionNeighbourAvgAggregateFragmentDoc,Pa as CandidateGenerationRejectionNeighbourCountAggregateFragmentDoc,Na as CandidateGenerationRejectionNeighbourFragmentDoc,Qa as CandidateGenerationRejectionNeighbourMaxAggregateFragmentDoc,Ra as CandidateGenerationRejectionNeighbourMinAggregateFragmentDoc,Sa as CandidateGenerationRejectionNeighbourSumAggregateFragmentDoc,Ta as CandidateMaxAggregateFragmentDoc,Ua as CandidateMinAggregateFragmentDoc,Wa as CandidateScheduleStateAvgAggregateFragmentDoc,Xa as CandidateScheduleStateCountAggregateFragmentDoc,Va as CandidateScheduleStateFragmentDoc,Ya as CandidateScheduleStateMaxAggregateFragmentDoc,Za as CandidateScheduleStateMinAggregateFragmentDoc,_a as CandidateScheduleStateSumAggregateFragmentDoc,ab as CandidateSignalsAvgAggregateFragmentDoc,bb as CandidateSignalsCountAggregateFragmentDoc,$a as CandidateSignalsFragmentDoc,cb as CandidateSignalsMaxAggregateFragmentDoc,db as CandidateSignalsMinAggregateFragmentDoc,eb as CandidateSignalsSumAggregateFragmentDoc,g as CandidateState,fb as CandidateSumAggregateFragmentDoc,h as CapabilityType,hb as ChatConnectionFragmentDoc,ib as ChatCountAggregateFragmentDoc,Li as ChatDocument,gb as ChatFragmentDoc,kb as ChatImportExecuteOutputFragmentDoc,lb as ChatImportPreviewOutputFragmentDoc,mb as ChatMaxAggregateFragmentDoc,qb as ChatMessageConnectionFragmentDoc,rb as ChatMessageCountAggregateFragmentDoc,Wi as ChatMessageDocument,pb as ChatMessageFragmentDoc,i as ChatMessageFromEnum,sb as ChatMessageMaxAggregateFragmentDoc,tb as ChatMessageMinAggregateFragmentDoc,j as ChatMessageOrderByRelevanceFieldEnum,Xi as ChatMessage_ArtifactsDocument,Yi as ChatMessage_ChatDocument,Zi as ChatMessage_Chat_DesktopDeviceDocument,_i as ChatMessage_Chat_InsightDocument,$i as ChatMessage_Chat_ProjectDocument,aj as ChatMessage_ContentsDocument,bj as ChatMessage_Contents_AgentDocument,cj as ChatMessage_Contents_MasksDocument,dj as ChatMessage_FeedbackDocument,ej as ChatMessagesDocument,ub as ChatMinAggregateFragmentDoc,k as ChatOrderByRelevanceFieldEnum,l as ChatSourceImportFidelityEnum,m as ChatSourceImportModeEnum,n as ChatSourceProviderEnum,Af as ChatTitleEventOutputFragmentDoc,o as ChatWorkspaceMode,Mi as Chat_AgentsDocument,Ni as Chat_ArtifactsDocument,Oi as Chat_DesktopDeviceDocument,Pi as Chat_DesktopDevice_DesktopBindingsDocument,Qi as Chat_InsightDocument,Ri as Chat_Insight_ReportMembersDocument,Si as Chat_Insight_ThumbnailFileDocument,Ti as Chat_MessagesDocument,Ui as Chat_ProjectDocument,Vi as Chat_Project_DesktopBindingDocument,fj as ChatsDocument,Vg as CloseActiveTabsDocument,Wg as ConnectIntegrationDocument,Xg as ConsumePulseEventsDocument,nb as ContentBlockAgentOutputFragmentDoc,vb as ContentBlockAvgAggregateFragmentDoc,wb as ContentBlockCountAggregateFragmentDoc,ob as ContentBlockFragmentDoc,xb as ContentBlockMaxAggregateFragmentDoc,yb as ContentBlockMinAggregateFragmentDoc,zb as ContentBlockSumAggregateFragmentDoc,p as ContentBlockType,Bb as ContentMaskCountAggregateFragmentDoc,Ab as ContentMaskFragmentDoc,Cb as ContentMaskMaxAggregateFragmentDoc,Db as ContentMaskMinAggregateFragmentDoc,Bf as ContextUsageEventOutputFragmentDoc,Yg as ContinueImportedChatDocument,Zg as ContinueInterpretationDocument,_g as CreateAgentDocument,$g as CreateChatDocument,ah as CreateDatabaseDocument,bh as CreateDocumentDocument,ch as CreateFeedbackDocument,dh as CreateFolderDocument,eh as CreateInsightDocument,fh as CreateIntegrationDocument,Eb as CreateIntegrationOutputFragmentDoc,gh as CreateProjectDocument,hh as CreateReportDocument,ih as CreateTableDocument,jh as CreateUserSkillFileDocument,kh as CreateUserSkillFolderDocument,Gb as CubeModelCountAggregateFragmentDoc,Fb as CubeModelFragmentDoc,Hb as CubeModelMaxAggregateFragmentDoc,Ib as CubeModelMinAggregateFragmentDoc,gj as CubeModelRevisionsDocument,Jb as DatabaseCatalogAvgAggregateFragmentDoc,Lb as DatabaseCatalogConnectionFragmentDoc,Mb as DatabaseCatalogCountAggregateFragmentDoc,lj as DatabaseCatalogDocument,Kb as DatabaseCatalogFragmentDoc,Nb as DatabaseCatalogMaxAggregateFragmentDoc,Ob as DatabaseCatalogMinAggregateFragmentDoc,q as DatabaseCatalogOrderByRelevanceFieldEnum,Pb as DatabaseCatalogSumAggregateFragmentDoc,mj as DatabaseCatalog_EngineDocument,nj as DatabaseCatalogsDocument,Rb as DatabaseConnectionFragmentDoc,Sb as DatabaseCountAggregateFragmentDoc,hj as DatabaseDocument,Ub as DatabaseEngineCountAggregateFragmentDoc,Tb as DatabaseEngineFragmentDoc,Vb as DatabaseEngineMaxAggregateFragmentDoc,Wb as DatabaseEngineMinAggregateFragmentDoc,Qb as DatabaseFragmentDoc,Xb as DatabaseMaxAggregateFragmentDoc,Yb as DatabaseMinAggregateFragmentDoc,r as DatabaseOrderByRelevanceFieldEnum,oj as DatabasePreparationDocument,_b as DatabasePreparationTableCountAggregateFragmentDoc,Zb as DatabasePreparationTableFragmentDoc,$b as DatabasePreparationTableMaxAggregateFragmentDoc,ac as DatabasePreparationTableMinAggregateFragmentDoc,pj as DatabaseSchemaDocument,ij as Database_EngineDocument,jj as Database_Engine_CatalogDocument,kj as Database_TablesDocument,qj as DatabasesDocument,cc as DeepAnalysisUsageAvgAggregateFragmentDoc,dc as DeepAnalysisUsageCountAggregateFragmentDoc,bc as DeepAnalysisUsageFragmentDoc,ec as DeepAnalysisUsageMaxAggregateFragmentDoc,fc as DeepAnalysisUsageMinAggregateFragmentDoc,gc as DeepAnalysisUsageSumAggregateFragmentDoc,lh as DeleteAgentDocument,mh as DeleteAiProviderSettingDocument,nh as DeleteArtifactDocument,oh as DeleteChatDocument,ph as DeleteDatabaseDocument,qh as DeleteDocumentDocument,rh as DeleteFolderDocument,sh as DeleteInsightDocument,th as DeleteInsightsDocument,uh as DeleteIntegrationDocument,vh as DeleteProjectDocument,wh as DeleteReportDocument,xh as DeleteSavedAiProviderModelDocument,yh as DeleteTableDocument,zh as DeleteUserSkillFileDocument,Ah as DeleteUserSkillFolderDocument,hc as DesktopDeviceAvgAggregateFragmentDoc,jc as DesktopDeviceConnectionFragmentDoc,kc as DesktopDeviceCountAggregateFragmentDoc,rj as DesktopDeviceDocument,ic as DesktopDeviceFragmentDoc,lc as DesktopDeviceMaxAggregateFragmentDoc,mc as DesktopDeviceMinAggregateFragmentDoc,s as DesktopDeviceOrderByRelevanceFieldEnum,nc as DesktopDeviceSumAggregateFragmentDoc,sj as DesktopDevice_ChatsDocument,tj as DesktopDevice_DesktopBindingsDocument,uj as DesktopDevice_DesktopBindings_ProjectDocument,vj as DesktopDevicesDocument,oc as DevAccessTokenOutputFragmentDoc,Bh as DisconnectIntegrationDocument,Ch as DismissPulseEventDocument,pc as DocumentCatalogAvgAggregateFragmentDoc,rc as DocumentCatalogConnectionFragmentDoc,sc as DocumentCatalogCountAggregateFragmentDoc,Cj as DocumentCatalogDocument,qc as DocumentCatalogFragmentDoc,tc as DocumentCatalogMaxAggregateFragmentDoc,uc as DocumentCatalogMinAggregateFragmentDoc,t as DocumentCatalogOrderByRelevanceFieldEnum,vc as DocumentCatalogSumAggregateFragmentDoc,Dj as DocumentCatalog_FormatDocument,Ej as DocumentCatalogsDocument,xc as DocumentConnectionFragmentDoc,zc as DocumentContentAvgAggregateFragmentDoc,Ac as DocumentContentCountAggregateFragmentDoc,yc as DocumentContentFragmentDoc,Bc as DocumentContentMaxAggregateFragmentDoc,Cc as DocumentContentMinAggregateFragmentDoc,Dc as DocumentContentSumAggregateFragmentDoc,Ec as DocumentCountAggregateFragmentDoc,wj as DocumentDocument,Gc as DocumentFormatCountAggregateFragmentDoc,Fc as DocumentFormatFragmentDoc,Hc as DocumentFormatMaxAggregateFragmentDoc,Ic as DocumentFormatMinAggregateFragmentDoc,wc as DocumentFragmentDoc,Jc as DocumentMaxAggregateFragmentDoc,Kc as DocumentMinAggregateFragmentDoc,u as DocumentOrderByRelevanceFieldEnum,xj as Document_ContentsDocument,yj as Document_FileDocument,zj as Document_FormatDocument,Aj as Document_Format_CatalogDocument,Bj as Document_TablesDocument,Fj as DocumentsDocument,v as EntitlementTier,Mc as EvidenceCountAggregateFragmentDoc,Lc as EvidenceFragmentDoc,Nc as EvidenceMaxAggregateFragmentDoc,Oc as EvidenceMinAggregateFragmentDoc,Dh as ExecuteChatImportDocument,Gj as ExportDocument,Hj as ExportWithInsightIdDocument,Qc as FailedSyncEventIngestionAvgAggregateFragmentDoc,Rc as FailedSyncEventIngestionCountAggregateFragmentDoc,Pc as FailedSyncEventIngestionFragmentDoc,Sc as FailedSyncEventIngestionMaxAggregateFragmentDoc,Tc as FailedSyncEventIngestionMinAggregateFragmentDoc,Uc as FailedSyncEventIngestionSumAggregateFragmentDoc,w as FeedActionType,Wc as FeedArtifactDataFragmentDoc,dd as FeedConnectionFragmentDoc,Xc as FeedDatabaseDataFragmentDoc,Yc as FeedDocumentDataFragmentDoc,Zc as FeedInsightDataFragmentDoc,_c as FeedIntegrationDataFragmentDoc,ed as FeedItemCountAggregateFragmentDoc,Ij as FeedItemDocument,cd as FeedItemFragmentDoc,fd as FeedItemGeneratedFragmentDoc,x as FeedItemKind,gd as FeedItemMaxAggregateFragmentDoc,hd as FeedItemMinAggregateFragmentDoc,y as FeedItemOrderByRelevanceFieldEnum,Jj as FeedItem_ActionDocument,Kj as FeedItem_DataDocument,Lj as FeedItemsDocument,$c as FeedLiveContextDataFragmentDoc,ad as FeedProjectDataFragmentDoc,bd as FeedPulseDataFragmentDoc,Vc as FeedSendMessageActionFragmentDoc,jd as FeedbackCountAggregateFragmentDoc,id as FeedbackFragmentDoc,kd as FeedbackMaxAggregateFragmentDoc,ld as FeedbackMinAggregateFragmentDoc,z as FeedbackOrderByRelevanceFieldEnum,A as FeedbackType,nd as FileAvgAggregateFragmentDoc,od as FileCountAggregateFragmentDoc,Mj as FileDocument,md as FileFragmentDoc,pd as FileMaxAggregateFragmentDoc,Nj as FileMetaDocument,qd as FileMinAggregateFragmentDoc,rd as FileModelFragmentDoc,B as FileOrderByRelevanceFieldEnum,sd as FileSumAggregateFragmentDoc,C as FileUrlVariant,Oj as FileUrlsDocument,Gf as FinalContentEventOutputFragmentDoc,Pj as FindFitTierDocument,ud as FolderConnectionFragmentDoc,vd as FolderCountAggregateFragmentDoc,Qj as FolderDocument,td as FolderFragmentDoc,wd as FolderMaxAggregateFragmentDoc,xd as FolderMinAggregateFragmentDoc,D as FolderOrderByRelevanceFieldEnum,Rj as FoldersDocument,Eh as GenerateUploadUriDocument,Sj as GetCapabilityDocument,Tj as GetDevAccessTokenDocument,Uj as GetLimitDocument,Vj as GetRemainingDocument,Wj as GetTokenUsageByModelDocument,Xj as GetTokenUsageHistoryDocument,Yj as GetTokenUsageStatusDocument,Zj as GetTokenUsageStatus_WindowsDocument,_j as GetTokenUsageStatus_Windows_DayDocument,$j as GetTokenUsageStatus_Windows_FiveHourDocument,ak as GetTokenUsageStatus_Windows_MonthDocument,bk as GetTokenUsageStatus_Windows_WeekDocument,ck as GetUsageDocument,jb as ImportedChatSummaryOutputFragmentDoc,zd as InferenceRequestAuditAvgAggregateFragmentDoc,Ad as InferenceRequestAuditCountAggregateFragmentDoc,yd as InferenceRequestAuditFragmentDoc,Bd as InferenceRequestAuditMaxAggregateFragmentDoc,Cd as InferenceRequestAuditMinAggregateFragmentDoc,Dd as InferenceRequestAuditSumAggregateFragmentDoc,Fd as InsightConnectionFragmentDoc,Gd as InsightCountAggregateFragmentDoc,dk as InsightDocument,Ed as InsightFragmentDoc,Hd as InsightMaxAggregateFragmentDoc,Id as InsightMinAggregateFragmentDoc,E as InsightOrderByRelevanceFieldEnum,ek as Insight_ChatDocument,fk as Insight_Chat_DesktopDeviceDocument,gk as Insight_Chat_ProjectDocument,hk as Insight_ReportMembersDocument,ik as Insight_ReportMembers_ReportDocument,jk as Insight_ReportsDocument,kk as Insight_ThumbnailFileDocument,lk as InsightsDocument,Jd as IntegrationAvgAggregateFragmentDoc,Kd as IntegrationCatalogAvgAggregateFragmentDoc,Md as IntegrationCatalogConnectionFragmentDoc,Nd as IntegrationCatalogCountAggregateFragmentDoc,pk as IntegrationCatalogDocument,Ld as IntegrationCatalogFragmentDoc,Od as IntegrationCatalogMaxAggregateFragmentDoc,Pd as IntegrationCatalogMinAggregateFragmentDoc,F as IntegrationCatalogOrderByRelevanceFieldEnum,Qd as IntegrationCatalogSumAggregateFragmentDoc,rk as IntegrationCatalogToolsDocument,qk as IntegrationCatalog_ProviderDocument,sk as IntegrationCatalogsDocument,Sd as IntegrationConnectionFragmentDoc,Td as IntegrationCountAggregateFragmentDoc,mk as IntegrationDocument,Rd as IntegrationFragmentDoc,Ud as IntegrationMaxAggregateFragmentDoc,Vd as IntegrationMinAggregateFragmentDoc,G as IntegrationOrderByRelevanceFieldEnum,Xd as IntegrationProviderCountAggregateFragmentDoc,Wd as IntegrationProviderFragmentDoc,Yd as IntegrationProviderMaxAggregateFragmentDoc,Zd as IntegrationProviderMinAggregateFragmentDoc,H as IntegrationStatus,_d as IntegrationSumAggregateFragmentDoc,nk as Integration_ProviderDocument,ok as Integration_Provider_CatalogDocument,tk as IntegrationsDocument,ae as InterpretationConnectionFragmentDoc,be as InterpretationCountAggregateFragmentDoc,$d as InterpretationFragmentDoc,ce as InterpretationMaxAggregateFragmentDoc,de as InterpretationMinAggregateFragmentDoc,I as InterpretationOrderByRelevanceFieldEnum,J as InterpretationType,uk as InterpretationsDocument,Hf as InterruptEventOutputFragmentDoc,fe as InvocationAvgAggregateFragmentDoc,ge as InvocationCountAggregateFragmentDoc,ee as InvocationFragmentDoc,he as InvocationMaxAggregateFragmentDoc,ie as InvocationMinAggregateFragmentDoc,je as InvocationSumAggregateFragmentDoc,K as LimitType,le as LiveContextConnectionFragmentDoc,me as LiveContextCountAggregateFragmentDoc,vk as LiveContextDocument,ke as LiveContextFragmentDoc,ne as LiveContextMaxAggregateFragmentDoc,oe as LiveContextMinAggregateFragmentDoc,L as LiveContextOrderByRelevanceFieldEnum,M as LiveContextStatus,wk as LiveContext_ItemsDocument,xk as LiveContext_SourceDocument,yk as LiveContext_Source_EvidencesDocument,zk as LiveContext_Source_SignalsDocument,Ak as LiveContextsDocument,N as LocalSandboxDeviceConnectionState,pe as LocalSandboxDeviceStatusModelFragmentDoc,Bk as LocalSandboxDeviceStatusesDocument,Ck as ManagedChatModelsDocument,O as McpAuthPhase,qe as McpAuthUpdateModelFragmentDoc,ql as McpAuthUpdatesDocument,se as McpClientInformationCountAggregateFragmentDoc,re as McpClientInformationFragmentDoc,te as McpClientInformationMaxAggregateFragmentDoc,ue as McpClientInformationMinAggregateFragmentDoc,we as McpCodeVerifierCountAggregateFragmentDoc,ve as McpCodeVerifierFragmentDoc,xe as McpCodeVerifierMaxAggregateFragmentDoc,ye as McpCodeVerifierMinAggregateFragmentDoc,Ae as McpServerCountAggregateFragmentDoc,ze as McpServerFragmentDoc,Be as McpServerMaxAggregateFragmentDoc,Ce as McpServerMinAggregateFragmentDoc,De as McpServerTestOutputFragmentDoc,Fe as McpTokensCountAggregateFragmentDoc,Ee as McpTokensFragmentDoc,Ge as McpTokensMaxAggregateFragmentDoc,He as McpTokensMinAggregateFragmentDoc,Je as McpToolCountAggregateFragmentDoc,Ie as McpToolFragmentDoc,Ke as McpToolMaxAggregateFragmentDoc,Le as McpToolMinAggregateFragmentDoc,If as MessageEndEventOutputFragmentDoc,Jf as MessageStartEventOutputFragmentDoc,Me as ModelTokenUsageFragmentDoc,P as NotificationCategory,Oe as NotificationConnectionFragmentDoc,Pe as NotificationCountAggregateFragmentDoc,Dk as NotificationDocument,Ne as NotificationFragmentDoc,Qe as NotificationMaxAggregateFragmentDoc,Re as NotificationMinAggregateFragmentDoc,Q as NotificationOrderByRelevanceFieldEnum,R as NotificationPriority,S as NotificationStatus,Fk as NotificationsByReferenceDocument,Ek as NotificationsDocument,T as NullsOrder,Fh as OpenActiveTabDocument,Se as PageInfoFragmentDoc,U as Presentation,Gh as PreviewChatImportDocument,Gk as PrivacyStatsDocument,Te as PrivacyStatsFragmentDoc,Ef as PrivacyStatsOutputFragmentDoc,Hk as PrivateMcpServersDocument,Ve as ProjectConnectionFragmentDoc,We as ProjectCountAggregateFragmentDoc,Ye as ProjectDesktopBindingCountAggregateFragmentDoc,Xe as ProjectDesktopBindingFragmentDoc,Ze as ProjectDesktopBindingMaxAggregateFragmentDoc,_e as ProjectDesktopBindingMinAggregateFragmentDoc,V as ProjectDesktopBindingOrderByRelevanceFieldEnum,W as ProjectDesktopContextKind,Ik as ProjectDocument,Ue as ProjectFragmentDoc,$e as ProjectMaxAggregateFragmentDoc,af as ProjectMinAggregateFragmentDoc,X as ProjectOrderByRelevanceFieldEnum,Y as ProjectSource,Jk as Project_ChatsDocument,Kk as Project_DesktopBindingDocument,Lk as Project_DesktopBinding_DeviceDocument,Mk as ProjectsDocument,Nk as PulseAppSummaryDocument,bf as PulseAppSummaryModelFragmentDoc,df as PulseEventConnectionFragmentDoc,ef as PulseEventCountAggregateFragmentDoc,Ok as PulseEventDocument,cf as PulseEventFragmentDoc,Z as PulseEventKind,ff as PulseEventMaxAggregateFragmentDoc,gf as PulseEventMinAggregateFragmentDoc,_ as PulseEventOrderByRelevanceFieldEnum,$ as PulseEventPriority,Pk as PulseEvent_IntegrationDocument,Qk as PulseEvent_Integration_ProviderDocument,Rk as PulseEventsDocument,hf as PulseTriggerSettingModelFragmentDoc,Sk as PulseTriggerSettingsDocument,Tk as QueryDocument,aa as QueryMode,Uk as QueryWithInsightIdDocument,Vk as QueryWithMessageIdDocument,Hh as ReanalyzeDocumentDocument,ba as ReasoningEffort,Kf as ReasoningEventOutputFragmentDoc,Ih as RefineAgentInstructionDocument,Jh as RefineSkillInstructionDocument,Kh as RefreshDatabaseSchemaDocument,Lh as RefreshInsightDocument,Mh as RegisterDesktopDeviceDocument,Nh as ReinterpretSourceDocument,Oh as ReinterpretSourcesOfuserDocument,jf as RelationCountAggregateFragmentDoc,if as RelationFragmentDoc,kf as RelationMaxAggregateFragmentDoc,lf as RelationMinAggregateFragmentDoc,ca as RelationType,Ph as RelocateInsightDocument,Qh as RemoveInsightFromReportDocument,Rh as RemoveMcpServerDocument,nf as ReportConnectionFragmentDoc,of as ReportCountAggregateFragmentDoc,Wk as ReportDocument,mf as ReportFragmentDoc,pf as ReportMaxAggregateFragmentDoc,rf as ReportMemberAvgAggregateFragmentDoc,sf as ReportMemberCountAggregateFragmentDoc,qf as ReportMemberFragmentDoc,tf as ReportMemberMaxAggregateFragmentDoc,uf as ReportMemberMinAggregateFragmentDoc,da as ReportMemberSize,vf as ReportMemberSumAggregateFragmentDoc,wf as ReportMinAggregateFragmentDoc,ea as ReportOrderByRelevanceFieldEnum,Xk as Report_InsightsDocument,Yk as Report_LayoutDocument,Zk as Report_Layout_InsightDocument,_k as ReportsDocument,Sh as ResetWorkspaceDocument,Th as ResolvePulseEventDocument,xf as ResolvedFileUrlFragmentDoc,Uh as RestoreCubeModelRevisionDocument,Vh as ResumeDatabasePreparationDocument,Wh as ResumeMessageDocument,Xh as ScheduleWorkspaceDeletionDocument,Yh as SendMessageDocument,fa as SendMessageModel,Zh as SetDatabasePrimaryKeyDocument,_h as SetTableColumnTypeDocument,$k as SkillCatalogDocument,yf as SkillCatalogItemFragmentDoc,ga as SkillCatalogSource,ha as SortOrder,Vf as StreamEventSchemaAnchorFragmentDoc,Cf as StreamMessageContentOutputFragmentDoc,Df as StreamMessageOutputFragmentDoc,Xf as SyncEventAvgAggregateFragmentDoc,Yf as SyncEventCountAggregateFragmentDoc,_f as SyncEventCursorAvgAggregateFragmentDoc,$f as SyncEventCursorCountAggregateFragmentDoc,Zf as SyncEventCursorFragmentDoc,ag as SyncEventCursorMaxAggregateFragmentDoc,bg as SyncEventCursorMinAggregateFragmentDoc,cg as SyncEventCursorSumAggregateFragmentDoc,Wf as SyncEventFragmentDoc,dg as SyncEventMaxAggregateFragmentDoc,eg as SyncEventMinAggregateFragmentDoc,fg as SyncEventSumAggregateFragmentDoc,$h as SyncProjectDesktopBindingDocument,hg as TableConnectionFragmentDoc,ig as TableCountAggregateFragmentDoc,al as TableDocument,gg as TableFragmentDoc,jg as TableMaxAggregateFragmentDoc,kg as TableMinAggregateFragmentDoc,ia as TableOrderByRelevanceFieldEnum,ja as TableStatus,bl as Table_DatabaseDocument,cl as Table_Database_EngineDocument,dl as Table_DocumentDocument,el as Table_Document_ContentsDocument,fl as Table_Document_FileDocument,gl as Table_Document_FormatDocument,hl as Table_FromRelationsDocument,il as Table_ToRelationsDocument,jl as TablesDocument,bi as TestMcpServerConnectionDocument,ai as TestMcpServerDocument,Lf as TextBlockEventOutputFragmentDoc,Mf as TextDeltaEventOutputFragmentDoc,mg as TokenUsageAvgAggregateFragmentDoc,ng as TokenUsageCountAggregateFragmentDoc,lg as TokenUsageFragmentDoc,ka as TokenUsageLimit,og as TokenUsageMaxAggregateFragmentDoc,pg as TokenUsageMinAggregateFragmentDoc,qg as TokenUsageSumAggregateFragmentDoc,rl as TokenUsageUpdatesDocument,Nf as ToolInputDeltaEventOutputFragmentDoc,Of as ToolResultArtifactOutputFragmentDoc,Pf as ToolResultEventOutputFragmentDoc,Qf as ToolStartEventOutputFragmentDoc,ci as UpdateAgentDocument,di as UpdateArtifactNameDocument,ei as UpdateChatDocument,fi as UpdateDatabaseDocument,gi as UpdateDocumentDocument,hi as UpdateFolderDocument,ii as UpdateInsightDocument,ji as UpdateInsightInReportDocument,ki as UpdateInsightThumbnailDocument,li as UpdateInterpDocument,mi as UpdateLiveContextDocument,ni as UpdateProjectDocument,oi as UpdatePulseTriggerDocument,pi as UpdateReportDocument,qi as UpdateTableDocument,ri as UpdateUserSkillFileDocument,si as UpdateUserSkillFolderDocument,ti as UpgradeCubeModelSemanticsDocument,ui as UpsertAiProviderSettingDocument,vi as UpsertWorkspaceAiModelDocument,la as UsageHistoryGranularity,Ff as UsageMetaOutputFragmentDoc,tg as UsageStatusFragmentDoc,sg as UsageWindowsStatusTypeFragmentDoc,vg as UserAiProviderSettingCountAggregateFragmentDoc,ug as UserAiProviderSettingFragmentDoc,wg as UserAiProviderSettingMaxAggregateFragmentDoc,xg as UserAiProviderSettingMinAggregateFragmentDoc,zg as UserSkillFileCountAggregateFragmentDoc,kl as UserSkillFileDocument,yg as UserSkillFileFragmentDoc,Ag as UserSkillFileMaxAggregateFragmentDoc,Bg as UserSkillFileMinAggregateFragmentDoc,Cg as UserSkillFileModelFragmentDoc,ll as UserSkillFilesDocument,Eg as UserSkillFolderCountAggregateFragmentDoc,ml as UserSkillFolderDocument,Dg as UserSkillFolderFragmentDoc,Fg as UserSkillFolderMaxAggregateFragmentDoc,Gg as UserSkillFolderMinAggregateFragmentDoc,Hg as UserSkillFolderModelFragmentDoc,nl as UserSkillFoldersDocument,Rf as WidgetBlockCompleteEventOutputFragmentDoc,Sf as WidgetBlockErrorEventOutputFragmentDoc,Tf as WidgetBlockStartEventOutputFragmentDoc,Uf as WidgetHtmlDeltaEventOutputFragmentDoc,rg as WindowDetailTypeFragmentDoc,ol as WorkspaceAiModelDocument,Jg as WorkspaceAiModelSettingCountAggregateFragmentDoc,Ig as WorkspaceAiModelSettingFragmentDoc,Kg as WorkspaceAiModelSettingMaxAggregateFragmentDoc,Lg as WorkspaceAiModelSettingMinAggregateFragmentDoc,Ng as WorkspaceDeleteScheduleCountAggregateFragmentDoc,Mg as WorkspaceDeleteScheduleFragmentDoc,Og as WorkspaceDeleteScheduleMaxAggregateFragmentDoc,Pg as WorkspaceDeleteScheduleMinAggregateFragmentDoc,pl as WorkspaceDeletionScheduleDocument}from'./chunk-IFSDIGN6.js';import'./chunk-EK7ODJWE.js';
@@ -1,254 +0,0 @@
1
- import { Signal, DestroyRef, EnvironmentProviders } from '@angular/core';
2
- import { D as DvinaSdkOptions } from '../../client-Bqi7gjM0.js';
3
- import { D as DvinaAsyncRef } from '../../types-Chg8ASmf.js';
4
- import '../../error-CsVoUTY8.js';
5
- import '../../sync-engine-DYHreGOv.js';
6
- import 'graphql';
7
- import 'dexie';
8
- import '../../client-Bb2gD6Iz.js';
9
- import '../../billing/index.js';
10
-
11
- /**
12
- * Angular adapter for @dvina/sdk.
13
- *
14
- * Provides primitives for integrating the Dvina SDK with Angular's DI and signal system:
15
- *
16
- * - {@link provideDvina} — register a singleton `DvinaSdk` instance in the Angular DI system
17
- * - {@link toSignal} — lightweight converter from `DvinaQueryRef` to a readonly `Signal`
18
- * - {@link dvnResource} — full resource primitive inspired by Angular's `resource()` API,
19
- * supporting both `Promise` and `AsyncIterable` loaders with reactive params tracking,
20
- * status/error signals, and automatic cleanup.
21
- *
22
- * @example
23
- * ```typescript
24
- * import { provideDvina, toSignal, dvnResource } from '@dvina/sdk/angular';
25
- * import { DvinaSdk } from '@dvina/sdk';
26
- *
27
- * // app.config.ts
28
- * export const appConfig: ApplicationConfig = {
29
- * providers: [
30
- * provideDvina(() => ({
31
- * getToken: (opts) => inject(AuthService).getAccessTokenSilently(opts),
32
- * language: () => inject(TranslocoService).getActiveLang(),
33
- * })),
34
- * ],
35
- * };
36
- *
37
- * // component.ts
38
- * @Component({ ... })
39
- * class ReportsComponent {
40
- * private sdk = inject(DvinaSdk);
41
- *
42
- * // Simple signal conversion
43
- * reports = toSignal(this.sdk.reports({ first: 20 }).watch());
44
- *
45
- * // Full resource with status tracking
46
- * reportResource = dvnResource({
47
- * params: () => ({ first: 20 }),
48
- * loader: ({ params }) => this.sdk.reports(params).watch(),
49
- * });
50
- * }
51
- * ```
52
- *
53
- * @packageDocumentation
54
- */
55
-
56
- interface ToSignalOptions {
57
- /**
58
- * Optional DestroyRef for automatic cleanup. If not provided, `inject(DestroyRef)`
59
- * is called — which requires an injection context (constructor, field initializer,
60
- * or `runInInjectionContext`).
61
- *
62
- * Pass explicitly when calling outside an injection context.
63
- *
64
- * Follows the same convention as Angular's `takeUntilDestroyed()`.
65
- */
66
- destroyRef?: DestroyRef;
67
- }
68
- /**
69
- * Convert a `DvinaQueryRef` (AsyncIterable) into a readonly Angular Signal.
70
- *
71
- * The signal updates automatically whenever the underlying Dexie-based SyncEngine emits new data.
72
- * Cleanup (disposal of the async iterable) happens automatically when the component/service
73
- * is destroyed via `DestroyRef`.
74
- *
75
- * Must be called in an **injection context** (field initializer, constructor,
76
- * or `runInInjectionContext`) unless `options.destroyRef` is provided explicitly.
77
- *
78
- * @param ref - A DvinaQueryRef returned by `.watch()` on any SDK query
79
- * @param options - Optional configuration
80
- * @returns A readonly Signal that reflects the latest value from the query ref
81
- *
82
- * @example
83
- * ```typescript
84
- * // Field initializer (most common)
85
- * reports = toSignal(this.sdk.reports({ first: 20 }).watch());
86
- *
87
- * // With explicit DestroyRef (for use outside injection context)
88
- * const destroyRef = inject(DestroyRef);
89
- * // ... later, in a method:
90
- * this.reports = toSignal(ref, { destroyRef });
91
- * ```
92
- */
93
- declare function toSignal<T>(ref: DvinaAsyncRef<T>, options?: ToSignalOptions): Signal<T | undefined>;
94
- /**
95
- * Status of a {@link DvnResourceRef}.
96
- *
97
- * Mirrors Angular's `ResourceStatus` with the statuses relevant to
98
- * Dvina SDK operations.
99
- *
100
- * | Status | `value()` | Description |
101
- * |---------------|-------------------|-------------|
102
- * | `'idle'` | `undefined` | `params` returned `undefined`; loader has not run. |
103
- * | `'loading'` | `undefined` | Loader is running for the first time. |
104
- * | `'reloading'` | Previous value | Loader is re-running (params changed or `reload()` called). |
105
- * | `'resolved'` | Resolved value | Loader completed successfully. |
106
- * | `'error'` | `undefined` | Loader threw an error. |
107
- */
108
- type DvnResourceStatus = 'idle' | 'loading' | 'reloading' | 'resolved' | 'error';
109
- /**
110
- * The object returned by {@link dvnResource}.
111
- *
112
- * Provides reactive access to the loader's value, status, and error,
113
- * plus imperative `reload()` and `destroy()` methods.
114
- */
115
- interface DvnResourceRef<TResult> {
116
- /** The most recently resolved value, or `undefined` while loading / on error / idle. */
117
- readonly value: Signal<TResult | undefined>;
118
- /** Current lifecycle status of the resource. */
119
- readonly status: Signal<DvnResourceStatus>;
120
- /** `true` when status is `'loading'` or `'reloading'`. */
121
- readonly isLoading: Signal<boolean>;
122
- /** The last error thrown by the loader, or `undefined`. */
123
- readonly error: Signal<Error | undefined>;
124
- /** Whether `value()` is not `undefined`. */
125
- hasValue(): boolean;
126
- /** Re-run the loader with the current params. Status transitions to `'reloading'`. */
127
- reload(): void;
128
- /** Abort / dispose any active loader and reset to `'idle'`. */
129
- destroy(): void;
130
- }
131
- /**
132
- * A loader function that returns either a `Promise` (one-shot fetch) or an
133
- * `AsyncIterable` / `DvinaQueryRef` (live stream).
134
- *
135
- * The runtime inspects the return value:
136
- * - If it has `Symbol.asyncIterator` → consumed as a stream (`for await…of`)
137
- * - Otherwise → awaited as a `Promise`
138
- */
139
- type DvnResourceLoader<TParams, TResult> = (ctx: DvnResourceLoaderCtx<TParams>) => Promise<TResult> | AsyncIterable<TResult>;
140
- /**
141
- * Context object passed to the loader function.
142
- *
143
- * When the resource has `params`, `ctx.params` contains the current
144
- * non-`undefined` params value. `abortSignal` can be forwarded to `fetch()`
145
- * or any other cancellable API.
146
- */
147
- interface DvnResourceLoaderCtx<TParams> {
148
- /** Current params value (never `undefined`). Only present when `params` is configured. */
149
- params: TParams;
150
- /** Aborted when params change, `reload()` is called, or the resource is destroyed. */
151
- abortSignal: AbortSignal;
152
- }
153
- /**
154
- * Create a Dvina resource **without reactive params**.
155
- *
156
- * The loader runs immediately and can be re-triggered via `reload()`.
157
- *
158
- * @example
159
- * ```typescript
160
- * config = dvnResource({
161
- * loader: () => this.sdk.config().fetch(),
162
- * });
163
- * ```
164
- */
165
- declare function dvnResource<TResult>(config: {
166
- params?: never;
167
- loader: (ctx: {
168
- abortSignal: AbortSignal;
169
- }) => Promise<TResult> | AsyncIterable<TResult>;
170
- }): DvnResourceRef<TResult>;
171
- /**
172
- * Create a Dvina resource **with reactive params**.
173
- *
174
- * The loader re-runs every time `params()` produces a new non-`undefined`
175
- * value. When `params()` returns `undefined` the resource enters `'idle'`.
176
- *
177
- * @example
178
- * ```typescript
179
- * // Promise-based (one-shot fetch)
180
- * userResource = dvnResource({
181
- * params: () => ({ id: this.userId() }),
182
- * loader: ({ params }) => this.sdk.user(params).fetch(),
183
- * });
184
- *
185
- * // AsyncIterable-based (live query)
186
- * reportsResource = dvnResource({
187
- * params: () => ({ first: 20 }),
188
- * loader: ({ params }) => this.sdk.reports(params).watch(),
189
- * });
190
- * ```
191
- */
192
- declare function dvnResource<TParams, TResult>(config: {
193
- params: () => TParams | undefined;
194
- loader: (ctx: DvnResourceLoaderCtx<TParams>) => Promise<TResult> | AsyncIterable<TResult>;
195
- }): DvnResourceRef<TResult>;
196
- /**
197
- * Register a singleton {@link DvinaSdk} instance in the Angular dependency injection system.
198
- *
199
- * Accepts either a static options object or a **factory function**. The factory
200
- * variant runs inside an injection context, so Angular's `inject()` can be used
201
- * to resolve auth services, language providers, and other dependencies.
202
- *
203
- * The SDK instance is automatically destroyed (WebSocket terminated, SSE stopped,
204
- * IndexedDB closed) when the environment injector is torn down.
205
- *
206
- * @param optionsOrFactory - A {@link DvinaSdkOptions} object, or a factory
207
- * function that returns one. The factory is called within an injection context.
208
- * @returns `EnvironmentProviders` to be added to the application config.
209
- *
210
- * @example
211
- * ```typescript
212
- * // app.config.ts
213
- * import { provideDvina } from '@dvina/sdk/angular';
214
- *
215
- * export const appConfig: ApplicationConfig = {
216
- * providers: [
217
- * provideDvina(() => {
218
- * const auth = inject(AuthService);
219
- * const transloco = inject(TranslocoService);
220
- *
221
- * return {
222
- * getToken: (opts) => auth.getAccessTokenSilently(opts),
223
- * language: () => transloco.getActiveLang(),
224
- * };
225
- * }),
226
- * ],
227
- * };
228
- * ```
229
- *
230
- * @example
231
- * ```typescript
232
- * // Static token (scripts, tests)
233
- * provideDvina({
234
- * token: 'my-static-token',
235
- * baseUrl: 'localhost:4000',
236
- * })
237
- * ```
238
- *
239
- * @example
240
- * ```typescript
241
- * // Consuming the SDK in a service
242
- * import { DvinaSdk } from '@dvina/sdk';
243
- *
244
- * @Injectable({ providedIn: 'root' })
245
- * export class ReportService {
246
- * private readonly sdk = inject(DvinaSdk);
247
- *
248
- * reports = toSignal(this.sdk.reports({ first: 20 }).watch());
249
- * }
250
- * ```
251
- */
252
- declare function provideDvina(optionsOrFactory: DvinaSdkOptions | (() => DvinaSdkOptions)): EnvironmentProviders;
253
-
254
- export { type DvnResourceLoader, type DvnResourceLoaderCtx, type DvnResourceRef, type DvnResourceStatus, type ToSignalOptions, dvnResource, provideDvina, toSignal };
@@ -1 +0,0 @@
1
- import {Mg}from'../../chunk-QNQ3WSMR.js';import'../../chunk-H3TI6B7T.js';import'../../chunk-IIQ3WGOJ.js';import'../../chunk-YUQTEBYO.js';import'../../chunk-5E7LX4YQ.js';import'../../chunk-IFSDIGN6.js';import'../../chunk-EK7ODJWE.js';import {inject,DestroyRef,signal,effect,computed,makeEnvironmentProviders,untracked}from'@angular/core';function L(e,i){let l=i?.destroyRef??inject(DestroyRef),t=signal(e.current),r=true;return (async()=>{try{for await(let o of e){if(!r)break;t.set(o);}}catch{}})(),l.onDestroy(()=>{r=false,e.dispose();}),t.asReadonly()}function j(e){let i=inject(DestroyRef),l="params"in e&&e.params!==void 0,t=signal(void 0),r=signal("idle"),o=signal(void 0),a=null,u=false,m=null,c=()=>{a?.abort(),a=null,u=false,m?.dispose(),m=null;},f=s=>{c(),o.set(void 0);let D=untracked(()=>t()!==void 0);r.set(D?"reloading":"loading"),a=new AbortController;let x=l?{params:s,abortSignal:a.signal}:{abortSignal:a.signal},d=e.loader(x);if(A(d)){h(d)&&(m=d),u=true;let p=a;(async()=>{try{for await(let n of d){if(!u)break;t.set(n),r.set("resolved"),o.set(void 0);}}catch(n){if(!u||p.signal.aborted)return;let y=n instanceof Error?n:new Error(String(n));o.set(y),r.set("error");}})();}else {let p=a;d.then(n=>{p.signal.aborted||(t.set(n),r.set("resolved"));},n=>{if(p.signal.aborted||n instanceof DOMException&&n.name==="AbortError")return;let y=n instanceof Error?n:new Error(String(n));o.set(y),r.set("error");});}};l?effect(()=>{let s=e.params();s!==void 0?f(s):(c(),t.set(void 0),r.set("idle"),o.set(void 0));}):f(),i.onDestroy(()=>{c();});let b=r.asReadonly(),S=computed(()=>{let s=r();return s==="loading"||s==="reloading"});return {value:t.asReadonly(),status:b,isLoading:S,error:o.asReadonly(),hasValue:()=>t()!==void 0,reload(){if(l){let s=e.params();s!==void 0&&f(s);}else f();},destroy(){c(),t.set(void 0),r.set("idle"),o.set(void 0);}}}function A(e){return e!=null&&typeof e=="object"&&Symbol.asyncIterator in e}function h(e){return e!=null&&typeof e=="object"&&"dispose"in e&&typeof e.dispose=="function"}function O(e){return makeEnvironmentProviders([{provide:Mg,useFactory:()=>{let i=typeof e=="function"?e():e;return new Mg(i)}}])}export{j as dvnResource,O as provideDvina,L as toSignal};
@@ -1 +0,0 @@
1
- var E=class extends Error{cause;constructor(n,r){super(n),this.name="DvinaError",this.cause=r;}},o=class extends E{errors;query;variables;constructor(n,r,t){let i=n.map(_=>_.message).join("; ")||"Unknown GraphQL error";super(i),this.name="DvinaGraphQLError",this.errors=n,this.query=r,this.variables=t;}},d=class extends E{status;constructor(n,r,t){super(n,t),this.name="DvinaNetworkError",this.status=r;}},p=class extends E{failedToken;constructor(n="Authentication failed",r,t){super(n,typeof r=="string"?t:r),this.name="DvinaAuthenticationError",this.failedToken=typeof r=="string"?r:void 0;}},s={SESSION_TOKEN_LIMIT_REACHED:"SESSION_TOKEN_LIMIT_REACHED",STORAGE_LIMIT_REACHED:"STORAGE_LIMIT_REACHED",DEEP_ANALYSIS_LIMIT_EXCEEDED:"DEEP_ANALYSIS_LIMIT_EXCEEDED",PLAN_DETAIL_RESTRICTION:"PLAN_DETAIL_RESTRICTION",RESOURCE_NOT_FOUND:"RESOURCE_NOT_FOUND"},I=new Set([s.PLAN_DETAIL_RESTRICTION,s.STORAGE_LIMIT_REACHED,s.DEEP_ANALYSIS_LIMIT_EXCEEDED]),c=class extends o{restrictionCode;constructor(n,r,t,i){super(n,t,i),this.name="DvinaPlanRestrictionError",this.restrictionCode=r;}},a=class extends o{constructor(n,r,t){super(n,r,t),this.name="DvinaTokenLimitError";}},u=class extends o{constructor(n,r,t){super(n,r,t),this.name="DvinaNotFoundError";}};function l(e){for(let n of e){let r=n.extensions?.code;if(r!=null)return String(r).toUpperCase()}}function R(e,n,r){let t=l(e);return t===s.SESSION_TOKEN_LIMIT_REACHED?new a(e,n,r):t===s.RESOURCE_NOT_FOUND?new u(e,n,r):t&&I.has(t)?new c(e,t,n,r):new o(e,n,r)}export{E as a,o as b,d as c,p as d,s as e,c as f,a as g,u as h,l as i,R as j};
@@ -1 +0,0 @@
1
- import {e,c}from'./chunk-H3TI6B7T.js';function a(n){return n.nodes}function r(n,o){return new e(n._request,o._fetch,[...n.nodes,...o.nodes],new c({hasNextPage:o.pageInfo.hasNextPage,hasPreviousPage:n.pageInfo.hasPreviousPage,startCursor:n.pageInfo.startCursor,endCursor:o.pageInfo.endCursor}),o.totalCount??n.totalCount)}export{a,r as b};
@@ -1 +0,0 @@
1
- var n=class{_request;_syncEngine;_subscribe;_baseUrl;constructor(e,s,o,i){this._request=e,this._syncEngine=s,this._subscribe=o,this._baseUrl=i;}};var u=50;function g(t){return {...t,first:t.first??(t.after?u:void 0),last:t.last??(t.before?u:void 0)}}var r=class{hasNextPage;hasPreviousPage;startCursor;endCursor;constructor(e){this.hasNextPage=e.hasNextPage,this.hasPreviousPage=e.hasPreviousPage,this.startCursor=e.startCursor,this.endCursor=e.endCursor;}},a=class extends n{pageInfo;nodes;totalCount;constructor(e){super(e),this.pageInfo=new r({hasNextPage:false,hasPreviousPage:false}),this.nodes=[];}},c=class extends a{_fetch;constructor(e,s,o,i,h){super(e),this._fetch=s,this.nodes=o,this.pageInfo=i,this.totalCount=h;}async fetchNext(e){if(this.pageInfo.hasNextPage){let s=await this._fetch({after:this.pageInfo.endCursor},e);s&&(this.nodes=[...this.nodes,...s.nodes],this.pageInfo.endCursor=s.pageInfo.endCursor??this.pageInfo.endCursor,this.pageInfo.hasNextPage=s.pageInfo.hasNextPage);}return this}async fetchPrevious(e){if(this.pageInfo.hasPreviousPage){let s=await this._fetch({before:this.pageInfo.startCursor},e);s&&(this.nodes=[...s.nodes,...this.nodes],this.pageInfo.startCursor=s.pageInfo.startCursor??this.pageInfo.startCursor,this.pageInfo.hasPreviousPage=s.pageInfo.hasPreviousPage);}return this}};export{n as a,g as b,r as c,a as d,c as e};