Skip to content

Commit 40de80d

Browse files
committed
feat(deps): change to stable SDK
1 parent ab4ece2 commit 40de80d

7 files changed

+81
-142
lines changed

README.md

+15-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ On service initialization, it sets up a single connection with the configuration
2020
|ngx-surreal|Angular |SurrealDB |
2121
|-----------|--------|------------|
2222
|^0.2.1 |>=18.0.0|^1.0.0 |
23+
|^1.0.0 |>=18.0.0|^2.0.0 |
2324

2425
## Installation
2526

@@ -93,12 +94,23 @@ export class AppModule {}
9394
The type definition for `SurrealConfig` is as follows:
9495

9596
```ts
96-
import type { ConnectionOptions } from 'surrealdb.js';
97+
import type { Surreal } from 'surrealdb';
9798

99+
export type ConnectionOptions = Parameters<Surreal['connect']>[1];
98100
export type SurrealConfig = ConnectionOptions & { url: string };
99101
```
100102

101-
See for all connection options the [definition for the `ConnectionOptions` type](https://github.com/surrealdb/surrealdb.js/blob/main/src/types.ts#L195).
103+
The following options are available for configuration:
104+
105+
```ts
106+
url: string;
107+
namespace?: string;
108+
database?: string;
109+
auth?: AnyAuth | Token;
110+
prepare?: (connection: Surreal) => unknown;
111+
versionCheck?: boolean;
112+
versionCheckTimeout?: number;
113+
```
102114

103115
## Usage
104116

@@ -158,7 +170,7 @@ export class ExampleComponent implements OnInit {
158170
}
159171
```
160172

161-
See for more examples and all available methods the [SurrealDB JavaScript SDK](https://surrealdb.com/docs/sdk/javascript/setup#sdk-methods).
173+
See for more examples and all available methods the [SurrealDB JavaScript SDK](https://surrealdb.com/docs/sdk/javascript/core).
162174

163175
## Links
164176

ng-package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
"lib": {
55
"entryFile": "src/public-api.ts"
66
},
7-
"allowedNonPeerDependencies": ["surrealdb.js"]
7+
"allowedNonPeerDependencies": ["surrealdb"]
88
}

package.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
{
22
"name": "ngx-surreal",
33
"description": "Lightweight Angular wrapper for the SurrealDB JavaScript SDK",
4-
"keywords": ["surrealdb", "angular", "database", "client"],
4+
"keywords": [
5+
"surrealdb",
6+
"angular",
7+
"database",
8+
"client"
9+
],
510
"version": "0.1.2",
611
"engines": {
712
"node": ">=18.0.0"
@@ -21,8 +26,8 @@
2126
"rxjs": "^7.8.1"
2227
},
2328
"dependencies": {
24-
"surrealdb.js": "1.0.0-beta.9",
25-
"tslib": "^2.3.0"
29+
"surrealdb": "^1.0.0",
30+
"tslib": "^2.7.0"
2631
},
2732
"devDependencies": {
2833
"rxjs": "^7.8.1"

pnpm-lock.yaml

+50-129
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/surreal.config.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import type { ConnectionOptions, Prettify } from 'surrealdb.js';
1+
import type { Surreal, Prettify } from 'surrealdb';
22

3+
export type ConnectionOptions = Parameters<Surreal['connect']>[1];
34
export type SurrealConfig = ConnectionOptions & { url: string };
45
export type PrettyRecord = Prettify<Record<string, unknown>>;
56

src/lib/surreal.service.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { computed, inject, Injectable } from '@angular/core';
22
import { from, type Observable } from 'rxjs';
3-
import { type ActionResult, type Patch, Surreal, type UUID, type RecordId as _RecordId, type StringRecordId, type AnyAuth, type ScopeAuth } from 'surrealdb.js';
4-
import { SURREAL_CONFIG_TOKEN } from './surreal.module';
3+
import { type RecordId as _RecordId, type ActionResult, type AnyAuth, type Patch, type ScopeAuth, type StringRecordId, Surreal, type Uuid } from 'surrealdb';
54
import type { PrettyRecord, SurrealUseOptions } from './surreal.config';
5+
import { SURREAL_CONFIG_TOKEN } from './surreal.module';
66

77
type RecordId<Tb extends string = string> = _RecordId<Tb> | StringRecordId;
88

@@ -130,7 +130,7 @@ export class SurrealService {
130130
* @param callback - Callback function that receives updates.
131131
* @param diff - If set to true, will return a set of patches instead of complete records
132132
*/
133-
public live<Result extends Record<string, unknown> | Patch = Record<string, unknown>>(...args: Parameters<Surreal['live']>): Observable<UUID> {
133+
public live<Result extends Record<string, unknown> | Patch = Record<string, unknown>>(...args: Parameters<Surreal['live']>): Observable<Uuid> {
134134
return from(this.db.live<Result>(...args));
135135
}
136136

@@ -260,7 +260,7 @@ export class SurrealService {
260260
* Stop listening for live query responses for a uuid
261261
* @param queryUuid - The LQ uuid that you want to stop listening to.
262262
*/
263-
public unsubscribeLive<Result extends Record<string, unknown> | Patch = Record<string, unknown>>(queryUuid: UUID) {
263+
public unsubscribeLive<Result extends Record<string, unknown> | Patch = Record<string, unknown>>(queryUuid: Uuid) {
264264
return from(this.db.unSubscribeLive<Result>(queryUuid, () => void 0));
265265
}
266266

src/public-api.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export * from './lib/surreal.module';
22
export * from './lib/surreal.service';
33
export * from './lib/surreal.config';
4-
export { RecordId, StringRecordId, PreparedQuery, UUID, Patch, LiveHandler } from 'surrealdb.js';
4+
export { RecordId, StringRecordId, PreparedQuery, Uuid, Patch, LiveHandler } from 'surrealdb';

0 commit comments

Comments
 (0)