@alienplatform/bindings 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +105 -0
- package/README.md +39 -1
- package/dist/errors.d.ts +50 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/factories.d.ts +2 -1
- package/dist/factories.d.ts.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/loader.d.ts +23 -0
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +123 -3
- package/dist/native.d.ts +4 -2
- package/dist/native.d.ts.map +1 -1
- package/dist/native.js +4 -2
- package/dist/types.d.ts +100 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +21 -21
package/LICENSE.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, Apache 2.0 Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 Alien Software, Inc.
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# `@alienplatform/bindings`
|
|
2
2
|
|
|
3
|
-
Direct TypeScript bindings for Alien storage, kv, queue, vault,
|
|
3
|
+
Direct TypeScript bindings for Alien storage, kv, queue, vault, linked-container
|
|
4
|
+
discovery, and Postgres over an
|
|
4
5
|
in-process [napi-rs](https://napi.rs) addon. The addon itself lives in the Rust
|
|
5
6
|
crate `crates/alien-bindings-node`; this package is the published JavaScript
|
|
6
7
|
wrapper that loads it.
|
|
@@ -20,6 +21,43 @@ const publicUrl = await database.getPublicUrl() // string | null
|
|
|
20
21
|
Use the internal URL for calls between resources in the same deployment. Use
|
|
21
22
|
the public URL only when the caller is outside that private network.
|
|
22
23
|
|
|
24
|
+
## Postgres
|
|
25
|
+
|
|
26
|
+
Postgres is connection-only: every backend speaks the same wire protocol, so the
|
|
27
|
+
binding hands back connection details and your app connects with its own driver.
|
|
28
|
+
Resolving a managed cloud backend (Aurora, Cloud SQL, Flexible Server) reads the
|
|
29
|
+
password from that cloud's secret store using the workload's own identity — the
|
|
30
|
+
binding itself only ever carries a locator for it.
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { Client } from "pg"
|
|
34
|
+
import { postgres } from "@alienplatform/bindings"
|
|
35
|
+
|
|
36
|
+
const conn = await postgres("my-db").connection()
|
|
37
|
+
|
|
38
|
+
// Field style: node-postgres parses a URL's sslmode and would override `ssl`, so
|
|
39
|
+
// pass the fields when you need `conn.ssl` to take effect.
|
|
40
|
+
const client = new Client({
|
|
41
|
+
host: conn.host,
|
|
42
|
+
port: conn.port,
|
|
43
|
+
database: conn.database,
|
|
44
|
+
user: conn.username,
|
|
45
|
+
password: conn.password,
|
|
46
|
+
ssl: conn.ssl,
|
|
47
|
+
})
|
|
48
|
+
await client.connect()
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`conn.connectionString` is the same details as a `postgres://` URL, with the
|
|
52
|
+
credentials percent-encoded, for drivers that take one.
|
|
53
|
+
|
|
54
|
+
External (BYO) Postgres bindings use verified TLS by default. Their `sslMode`
|
|
55
|
+
policy is deliberately limited to `"verify-full"` and `"disable"` because
|
|
56
|
+
node-postgres cannot represent libpq's opportunistic `prefer` fallback without
|
|
57
|
+
owning the connection attempt. Use `"disable"` only as an explicit compatibility
|
|
58
|
+
opt-out for a plaintext-only server; missing legacy configuration defaults to
|
|
59
|
+
`"verify-full"`.
|
|
60
|
+
|
|
23
61
|
## Native addon resolution
|
|
24
62
|
|
|
25
63
|
The addon is loaded lazily on the first binding operation (never at import — the
|
package/dist/errors.d.ts
CHANGED
|
@@ -40,6 +40,55 @@ export declare const BindingNotConfiguredError: {
|
|
|
40
40
|
envVar: z.ZodString;
|
|
41
41
|
}, z.core.$strip>>;
|
|
42
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* Thrown when the native addon reports a Postgres `sslmode` this package does not
|
|
45
|
+
* recognize, which means the addon and this wrapper disagree about the Rust `SslMode`
|
|
46
|
+
* enum — a version skew between the two halves of the package.
|
|
47
|
+
*
|
|
48
|
+
* `sslmode` is the value the addon sent; `expected` is the set this wrapper accepts.
|
|
49
|
+
* Not retryable: a skew is fixed by aligning versions, not by trying again.
|
|
50
|
+
*/
|
|
51
|
+
export declare const UnknownPostgresSslModeError: {
|
|
52
|
+
metadata: import("@alienplatform/core").AlienErrorMetadata<z.ZodObject<{
|
|
53
|
+
sslmode: z.ZodString;
|
|
54
|
+
expected: z.ZodArray<z.ZodString>;
|
|
55
|
+
}, z.core.$strip>>;
|
|
56
|
+
contextSchema: z.ZodObject<{
|
|
57
|
+
sslmode: z.ZodString;
|
|
58
|
+
expected: z.ZodArray<z.ZodString>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
create: (context: {
|
|
61
|
+
sslmode: string;
|
|
62
|
+
expected: string[];
|
|
63
|
+
}) => import("@alienplatform/core").AlienErrorDefinition<z.ZodObject<{
|
|
64
|
+
sslmode: z.ZodString;
|
|
65
|
+
expected: z.ZodArray<z.ZodString>;
|
|
66
|
+
}, z.core.$strip>>;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Thrown when the native addon reports a Postgres TLS policy that cannot be
|
|
70
|
+
* applied safely, such as a verified mode without any CA roots.
|
|
71
|
+
*
|
|
72
|
+
* This indicates wrapper/addon version skew or a malformed resolved binding.
|
|
73
|
+
* It is not retryable because retrying cannot repair the contract.
|
|
74
|
+
*/
|
|
75
|
+
export declare const InvalidPostgresTlsConfigError: {
|
|
76
|
+
metadata: import("@alienplatform/core").AlienErrorMetadata<z.ZodObject<{
|
|
77
|
+
sslmode: z.ZodString;
|
|
78
|
+
reason: z.ZodString;
|
|
79
|
+
}, z.core.$strip>>;
|
|
80
|
+
contextSchema: z.ZodObject<{
|
|
81
|
+
sslmode: z.ZodString;
|
|
82
|
+
reason: z.ZodString;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
create: (context: {
|
|
85
|
+
sslmode: string;
|
|
86
|
+
reason: string;
|
|
87
|
+
}) => import("@alienplatform/core").AlienErrorDefinition<z.ZodObject<{
|
|
88
|
+
sslmode: z.ZodString;
|
|
89
|
+
reason: z.ZodString;
|
|
90
|
+
}, z.core.$strip>>;
|
|
91
|
+
};
|
|
43
92
|
/**
|
|
44
93
|
* Recover a typed {@link AlienError} from an error thrown by the native addon.
|
|
45
94
|
*
|
|
@@ -53,4 +102,5 @@ export declare const BindingNotConfiguredError: {
|
|
|
53
102
|
* `BINDINGS_ERROR`, preserving the original message.
|
|
54
103
|
*/
|
|
55
104
|
export declare function unwrapNapiError(err: unknown): AlienError;
|
|
105
|
+
export { BindingNotFoundError } from "@alienplatform/core";
|
|
56
106
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAA;AAI3B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAA;AAElC;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;CAWpC,CAAA;AAwCF;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,UAAU,CAsCxD"}
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAA;AAI3B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAA;AAElC;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;CAWpC,CAAA;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;CAUtC,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;CAUxC,CAAA;AAwCF;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,UAAU,CAsCxD;AAGD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA"}
|
package/dist/factories.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* correctly even when destructured off the handle (`const { get } = storage(x)`).
|
|
14
14
|
*/
|
|
15
15
|
import type { NativeAddon } from "./loader.js";
|
|
16
|
-
import type { Container, Kv, Queue, Storage, Vault } from "./types.js";
|
|
16
|
+
import type { Container, Kv, Postgres, Queue, Storage, Vault } from "./types.js";
|
|
17
17
|
/** The public factory surface. */
|
|
18
18
|
export interface Factories {
|
|
19
19
|
storage(name: string): Storage;
|
|
@@ -21,6 +21,7 @@ export interface Factories {
|
|
|
21
21
|
queue(name: string): Queue;
|
|
22
22
|
vault(name: string): Vault;
|
|
23
23
|
container(name: string): Container;
|
|
24
|
+
postgres(name: string): Postgres;
|
|
24
25
|
}
|
|
25
26
|
/** Build the factories bound to a given addon provider. */
|
|
26
27
|
export declare function createFactories(getAddon: () => NativeAddon): Factories;
|
package/dist/factories.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../src/factories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../src/factories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH,OAAO,KAAK,EACV,WAAW,EASZ,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EACV,SAAS,EACT,EAAE,EAGF,QAAQ,EAIR,KAAK,EAGL,OAAO,EACP,KAAK,EACN,MAAM,YAAY,CAAA;AA8PnB,kCAAkC;AAClC,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IAC9B,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,EAAE,CAAA;IACpB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAA;IAC1B,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAA;IAC1B,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAA;CACjC;AAED,2DAA2D;AAC3D,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,WAAW,GAAG,SAAS,CAStE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `@alienplatform/bindings` — direct TypeScript bindings for Alien storage, kv,
|
|
3
|
-
* queue, vault,
|
|
4
|
-
* `alien-bindings` crate.
|
|
3
|
+
* queue, vault, linked containers, and Postgres, backed by an in-process napi-rs addon
|
|
4
|
+
* over the Rust `alien-bindings` crate.
|
|
5
5
|
*
|
|
6
6
|
* Constructing a factory (`storage("x")`, `kv("y")`, …) does no I/O and needs no
|
|
7
7
|
* addon; the native module loads on the first operation. The first operation
|
|
@@ -18,6 +18,8 @@ export declare const queue: (name: string) => import("./types.js").Queue;
|
|
|
18
18
|
export declare const vault: (name: string) => import("./types.js").Vault;
|
|
19
19
|
/** Resolve the linked-container binding named `name`. */
|
|
20
20
|
export declare const container: (name: string) => import("./types.js").Container;
|
|
21
|
-
|
|
22
|
-
export
|
|
21
|
+
/** Resolve the Postgres binding named `name`. */
|
|
22
|
+
export declare const postgres: (name: string) => import("./types.js").Postgres;
|
|
23
|
+
export { AlienError, BindingNotConfiguredError, BindingNotFoundError, defineError, InvalidPostgresTlsConfigError, UnknownPostgresSslModeError, } from "./errors.js";
|
|
24
|
+
export type { Container, Kv, KvScanItem, KvScanResult, KvSetOptions, ObjectMeta, Postgres, PostgresConnection, PostgresSslMode, PostgresTlsOptions, PresignedRequest, Queue, QueueMessage, SignedUrlMethod, SignedUrlOptions, Storage, Vault, } from "./types.js";
|
|
23
25
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,gDAAgD;AAChD,eAAO,MAAM,OAAO,gDAAoB,CAAA;AACxC,kDAAkD;AAClD,eAAO,MAAM,EAAE,2CAAe,CAAA;AAC9B,8CAA8C;AAC9C,eAAO,MAAM,KAAK,8CAAkB,CAAA;AACpC,8CAA8C;AAC9C,eAAO,MAAM,KAAK,8CAAkB,CAAA;AACpC,yDAAyD;AACzD,eAAO,MAAM,SAAS,kDAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,gDAAgD;AAChD,eAAO,MAAM,OAAO,gDAAoB,CAAA;AACxC,kDAAkD;AAClD,eAAO,MAAM,EAAE,2CAAe,CAAA;AAC9B,8CAA8C;AAC9C,eAAO,MAAM,KAAK,8CAAkB,CAAA;AACpC,8CAA8C;AAC9C,eAAO,MAAM,KAAK,8CAAkB,CAAA;AACpC,yDAAyD;AACzD,eAAO,MAAM,SAAS,kDAAsB,CAAA;AAC5C,iDAAiD;AACjD,eAAO,MAAM,QAAQ,iDAAqB,CAAA;AAE1C,OAAO,EACL,UAAU,EACV,yBAAyB,EACzB,oBAAoB,EACpB,WAAW,EACX,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,SAAS,EACT,EAAE,EACF,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,KAAK,GACN,MAAM,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as BindingNotConfiguredError, i as AlienError,
|
|
1
|
+
import { a as BindingNotConfiguredError, c as UnknownPostgresSslModeError, i as AlienError, l as defineError, o as BindingNotFoundError, r as createFactories, s as InvalidPostgresTlsConfigError, t as loadAddon } from "./loader.js";
|
|
2
2
|
//#region src/index.ts
|
|
3
3
|
/**
|
|
4
4
|
* `@alienplatform/bindings` — direct TypeScript bindings for Alien storage, kv,
|
|
5
|
-
* queue, vault,
|
|
6
|
-
* `alien-bindings` crate.
|
|
5
|
+
* queue, vault, linked containers, and Postgres, backed by an in-process napi-rs addon
|
|
6
|
+
* over the Rust `alien-bindings` crate.
|
|
7
7
|
*
|
|
8
8
|
* Constructing a factory (`storage("x")`, `kv("y")`, …) does no I/O and needs no
|
|
9
9
|
* addon; the native module loads on the first operation. The first operation
|
|
@@ -21,5 +21,7 @@ const queue = factories.queue;
|
|
|
21
21
|
const vault = factories.vault;
|
|
22
22
|
/** Resolve the linked-container binding named `name`. */
|
|
23
23
|
const container = factories.container;
|
|
24
|
+
/** Resolve the Postgres binding named `name`. */
|
|
25
|
+
const postgres = factories.postgres;
|
|
24
26
|
//#endregion
|
|
25
|
-
export { AlienError, BindingNotConfiguredError, container, defineError, kv, queue, storage, vault };
|
|
27
|
+
export { AlienError, BindingNotConfiguredError, BindingNotFoundError, InvalidPostgresTlsConfigError, UnknownPostgresSslModeError, container, defineError, kv, postgres, queue, storage, vault };
|
package/dist/loader.d.ts
CHANGED
|
@@ -89,6 +89,28 @@ export interface RawContainerHandle {
|
|
|
89
89
|
getInternalUrl(): Promise<string>;
|
|
90
90
|
getPublicUrl(): Promise<string | null>;
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Raw napi Postgres connection. `sslmode` is the exact query-parameter value the
|
|
94
|
+
* Rust `SslMode` emits.
|
|
95
|
+
*/
|
|
96
|
+
export interface RawPostgresConnection {
|
|
97
|
+
connectionString: string;
|
|
98
|
+
host: string;
|
|
99
|
+
port: number;
|
|
100
|
+
database: string;
|
|
101
|
+
username: string;
|
|
102
|
+
password: string;
|
|
103
|
+
sslmode: unknown;
|
|
104
|
+
caCertificates: unknown;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Raw napi Postgres handle. `connection()` is synchronous: the Rust provider has
|
|
108
|
+
* already resolved everything (including reading a cloud backend's password from
|
|
109
|
+
* its secret store) by the time the handle exists.
|
|
110
|
+
*/
|
|
111
|
+
export interface RawPostgresHandle {
|
|
112
|
+
connection(): RawPostgresConnection;
|
|
113
|
+
}
|
|
92
114
|
/** Raw napi vault handle. */
|
|
93
115
|
export interface RawVaultHandle {
|
|
94
116
|
getSecret(name: string): Promise<string>;
|
|
@@ -103,6 +125,7 @@ export interface RawBindingsHandle {
|
|
|
103
125
|
queue(name: string): Promise<RawQueueHandle>;
|
|
104
126
|
vault(name: string): Promise<RawVaultHandle>;
|
|
105
127
|
container(name: string): Promise<RawContainerHandle>;
|
|
128
|
+
postgres(name: string): Promise<RawPostgresHandle>;
|
|
106
129
|
}
|
|
107
130
|
/** The complete napi addon module surface consumed by the wrapper. */
|
|
108
131
|
export interface NativeAddon {
|
package/dist/loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AASH,0BAA0B;AAC1B,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd;AAED,4BAA4B;AAC5B,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,SAAS,EAAE,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,gCAAgC;AAChC,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,kCAAkC;AAClC,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChC;AAED,8BAA8B;AAC9B,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,GAAG,MAAM,CAAA;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,+BAA+B;AAC/B,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAClC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,IAAI,CAAC,MAAM,C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CAAA;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;CACnD;AAED,sEAAsE;AACtE,MAAM,WAAW,WAAW;IAC1B,cAAc,EAAE,UAAU,iBAAiB,CAAA;IAC3C,OAAO,IAAI,MAAM,CAAA;CAClB;AAED,0DAA0D;AAC1D,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,CAAA;AAEtC;;;;;;;;;GASG;AACH,wBAAgB,eAAe,IAAI,SAAS,CAW3C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,IAAI,GAAE,MAAM,CAAC,YAA2B,EACxC,IAAI,GAAE,SAA4D,GACjE,MAAM,CAaR;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,MAAgD,GACzD,MAAM,GAAG,SAAS,CAWpB;AASD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAO7F;AAKD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAE9D;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,WAAW,CA0DvC"}
|
package/dist/loader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
import { AlienError, defineError } from "@alienplatform/core";
|
|
2
|
+
import { AlienError, BindingNotFoundError, defineError } from "@alienplatform/core";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
@@ -3380,6 +3380,41 @@ const BindingNotConfiguredError = defineError({
|
|
|
3380
3380
|
internal: false,
|
|
3381
3381
|
httpStatusCode: 400
|
|
3382
3382
|
});
|
|
3383
|
+
/**
|
|
3384
|
+
* Thrown when the native addon reports a Postgres `sslmode` this package does not
|
|
3385
|
+
* recognize, which means the addon and this wrapper disagree about the Rust `SslMode`
|
|
3386
|
+
* enum — a version skew between the two halves of the package.
|
|
3387
|
+
*
|
|
3388
|
+
* `sslmode` is the value the addon sent; `expected` is the set this wrapper accepts.
|
|
3389
|
+
* Not retryable: a skew is fixed by aligning versions, not by trying again.
|
|
3390
|
+
*/
|
|
3391
|
+
const UnknownPostgresSslModeError = defineError({
|
|
3392
|
+
code: "UNKNOWN_POSTGRES_SSLMODE",
|
|
3393
|
+
context: object({
|
|
3394
|
+
sslmode: string(),
|
|
3395
|
+
expected: array(string())
|
|
3396
|
+
}),
|
|
3397
|
+
message: ({ sslmode, expected }) => `@alienplatform/bindings received an unknown Postgres sslmode '${sslmode}' from the native addon; expected one of ${expected.join(", ")}.`,
|
|
3398
|
+
retryable: false,
|
|
3399
|
+
internal: false
|
|
3400
|
+
});
|
|
3401
|
+
/**
|
|
3402
|
+
* Thrown when the native addon reports a Postgres TLS policy that cannot be
|
|
3403
|
+
* applied safely, such as a verified mode without any CA roots.
|
|
3404
|
+
*
|
|
3405
|
+
* This indicates wrapper/addon version skew or a malformed resolved binding.
|
|
3406
|
+
* It is not retryable because retrying cannot repair the contract.
|
|
3407
|
+
*/
|
|
3408
|
+
const InvalidPostgresTlsConfigError = defineError({
|
|
3409
|
+
code: "INVALID_POSTGRES_TLS_CONFIG",
|
|
3410
|
+
context: object({
|
|
3411
|
+
sslmode: string(),
|
|
3412
|
+
reason: string()
|
|
3413
|
+
}),
|
|
3414
|
+
message: ({ sslmode, reason }) => `@alienplatform/bindings received an invalid Postgres TLS configuration for sslmode '${sslmode}' from the native addon: ${reason}.`,
|
|
3415
|
+
retryable: false,
|
|
3416
|
+
internal: false
|
|
3417
|
+
});
|
|
3383
3418
|
/** Fallback code for napi-internal errors whose message is not an envelope. */
|
|
3384
3419
|
const GENERIC_BINDINGS_CODE = "BINDINGS_ERROR";
|
|
3385
3420
|
/** Envelope codes the wrapper maps to a dedicated typed error. */
|
|
@@ -3540,6 +3575,90 @@ function makeVault(handle) {
|
|
|
3540
3575
|
list: () => guard(handle, (raw) => raw.listSecrets())
|
|
3541
3576
|
};
|
|
3542
3577
|
}
|
|
3578
|
+
const POSTGRES_SSL_MODES = {
|
|
3579
|
+
disable: true,
|
|
3580
|
+
"verify-ca": true,
|
|
3581
|
+
"verify-full": true
|
|
3582
|
+
};
|
|
3583
|
+
function postgresSslModeLabel(sslmode) {
|
|
3584
|
+
return typeof sslmode === "string" ? sslmode : String(sslmode);
|
|
3585
|
+
}
|
|
3586
|
+
function invalidPostgresTlsConfig(sslmode, reason) {
|
|
3587
|
+
return new AlienError(InvalidPostgresTlsConfigError.create({
|
|
3588
|
+
sslmode: postgresSslModeLabel(sslmode),
|
|
3589
|
+
reason
|
|
3590
|
+
}).toOptions());
|
|
3591
|
+
}
|
|
3592
|
+
function isPostgresSslMode(value) {
|
|
3593
|
+
return typeof value === "string" && Object.hasOwn(POSTGRES_SSL_MODES, value);
|
|
3594
|
+
}
|
|
3595
|
+
function hasAtLeastOne(values) {
|
|
3596
|
+
return values.length > 0;
|
|
3597
|
+
}
|
|
3598
|
+
/**
|
|
3599
|
+
* Decode the raw addon connection into the public discriminated union, deriving
|
|
3600
|
+
* node-postgres TLS options from the Rust-resolved mode and provider roots.
|
|
3601
|
+
*
|
|
3602
|
+
* An unrecognized `sslmode` means the addon and this wrapper disagree about the
|
|
3603
|
+
* `SslMode` enum — a version skew that must fail loudly rather than produce a
|
|
3604
|
+
* connection with a silently wrong TLS posture. It throws
|
|
3605
|
+
* {@link UnknownPostgresSslModeError} so a caller can discriminate it by `code`;
|
|
3606
|
+
* `guard` passes an `AlienError` through untouched.
|
|
3607
|
+
*/
|
|
3608
|
+
function toPostgresConnection(raw) {
|
|
3609
|
+
if (!isPostgresSslMode(raw.sslmode)) throw new AlienError(UnknownPostgresSslModeError.create({
|
|
3610
|
+
sslmode: postgresSslModeLabel(raw.sslmode),
|
|
3611
|
+
expected: Object.keys(POSTGRES_SSL_MODES)
|
|
3612
|
+
}).toOptions());
|
|
3613
|
+
if (!Array.isArray(raw.caCertificates)) throw invalidPostgresTlsConfig(raw.sslmode, "caCertificates must be an array");
|
|
3614
|
+
const caCertificates = [];
|
|
3615
|
+
const rawCaCertificates = raw.caCertificates;
|
|
3616
|
+
for (const [index, certificate] of rawCaCertificates.entries()) {
|
|
3617
|
+
if (typeof certificate !== "string") throw invalidPostgresTlsConfig(raw.sslmode, `caCertificates[${index}] must be a string`);
|
|
3618
|
+
if (certificate.trim().length === 0) throw invalidPostgresTlsConfig(raw.sslmode, `caCertificates[${index}] cannot be empty`);
|
|
3619
|
+
caCertificates.push(certificate);
|
|
3620
|
+
}
|
|
3621
|
+
const fields = {
|
|
3622
|
+
connectionString: raw.connectionString,
|
|
3623
|
+
host: raw.host,
|
|
3624
|
+
port: raw.port,
|
|
3625
|
+
database: raw.database,
|
|
3626
|
+
username: raw.username,
|
|
3627
|
+
password: raw.password
|
|
3628
|
+
};
|
|
3629
|
+
switch (raw.sslmode) {
|
|
3630
|
+
case "disable":
|
|
3631
|
+
if (caCertificates.length > 0) throw invalidPostgresTlsConfig(raw.sslmode, "disable cannot carry CA certificates");
|
|
3632
|
+
return {
|
|
3633
|
+
...fields,
|
|
3634
|
+
sslmode: raw.sslmode,
|
|
3635
|
+
ssl: false
|
|
3636
|
+
};
|
|
3637
|
+
case "verify-ca":
|
|
3638
|
+
if (!hasAtLeastOne(caCertificates)) throw invalidPostgresTlsConfig(raw.sslmode, "verify-ca requires at least one CA certificate");
|
|
3639
|
+
return {
|
|
3640
|
+
...fields,
|
|
3641
|
+
sslmode: raw.sslmode,
|
|
3642
|
+
ssl: {
|
|
3643
|
+
ca: caCertificates,
|
|
3644
|
+
rejectUnauthorized: true,
|
|
3645
|
+
checkServerIdentity: () => void 0
|
|
3646
|
+
}
|
|
3647
|
+
};
|
|
3648
|
+
case "verify-full": return {
|
|
3649
|
+
...fields,
|
|
3650
|
+
sslmode: raw.sslmode,
|
|
3651
|
+
ssl: {
|
|
3652
|
+
...caCertificates.length > 0 ? { ca: caCertificates } : {},
|
|
3653
|
+
rejectUnauthorized: true
|
|
3654
|
+
}
|
|
3655
|
+
};
|
|
3656
|
+
default: return raw.sslmode;
|
|
3657
|
+
}
|
|
3658
|
+
}
|
|
3659
|
+
function makePostgres(handle) {
|
|
3660
|
+
return { connection: () => guard(handle, async (raw) => toPostgresConnection(raw.connection())) };
|
|
3661
|
+
}
|
|
3543
3662
|
/** Build the factories bound to a given addon provider. */
|
|
3544
3663
|
function createFactories(getAddon) {
|
|
3545
3664
|
return {
|
|
@@ -3547,7 +3666,8 @@ function createFactories(getAddon) {
|
|
|
3547
3666
|
kv: (name) => makeKv(lazyHandle(getAddon, name, (b, n) => b.kv(n))),
|
|
3548
3667
|
queue: (name) => makeQueue(lazyHandle(getAddon, name, (b, n) => b.queue(n))),
|
|
3549
3668
|
vault: (name) => makeVault(lazyHandle(getAddon, name, (b, n) => b.vault(n))),
|
|
3550
|
-
container: (name) => makeContainer(lazyHandle(getAddon, name, (b, n) => b.container(n)))
|
|
3669
|
+
container: (name) => makeContainer(lazyHandle(getAddon, name, (b, n) => b.container(n))),
|
|
3670
|
+
postgres: (name) => makePostgres(lazyHandle(getAddon, name, (b, n) => b.postgres(n)))
|
|
3551
3671
|
};
|
|
3552
3672
|
}
|
|
3553
3673
|
//#endregion
|
|
@@ -3716,4 +3836,4 @@ function loadAddon() {
|
|
|
3716
3836
|
throw new Error(`Cannot load the @alienplatform/bindings native addon for '${triple}'. Install the '${pkg}' prebuild, or build it locally with \`napi build --platform\` in crates/alien-bindings-node, or set ALIEN_BINDINGS_ADDON_PATH to a built .node file.`);
|
|
3717
3837
|
}
|
|
3718
3838
|
//#endregion
|
|
3719
|
-
export { BindingNotConfiguredError as a, AlienError as i, registerEmbeddedAddon as n,
|
|
3839
|
+
export { BindingNotConfiguredError as a, UnknownPostgresSslModeError as c, AlienError as i, defineError as l, registerEmbeddedAddon as n, BindingNotFoundError as o, createFactories as r, InvalidPostgresTlsConfigError as s, loadAddon as t };
|
package/dist/native.d.ts
CHANGED
|
@@ -38,6 +38,8 @@ export declare const queue: (name: string) => import("./types.js").Queue;
|
|
|
38
38
|
export declare const vault: (name: string) => import("./types.js").Vault;
|
|
39
39
|
/** Resolve the linked-container binding named `name`. */
|
|
40
40
|
export declare const container: (name: string) => import("./types.js").Container;
|
|
41
|
-
|
|
42
|
-
export
|
|
41
|
+
/** Resolve the Postgres binding named `name`. */
|
|
42
|
+
export declare const postgres: (name: string) => import("./types.js").Postgres;
|
|
43
|
+
export { AlienError, BindingNotConfiguredError, defineError, InvalidPostgresTlsConfigError, UnknownPostgresSslModeError, } from "./errors.js";
|
|
44
|
+
export type { Container, Kv, KvScanItem, KvScanResult, KvSetOptions, ObjectMeta, Postgres, PostgresConnection, PostgresSslMode, PostgresTlsOptions, PresignedRequest, Queue, QueueMessage, SignedUrlMethod, SignedUrlOptions, Storage, Vault, } from "./types.js";
|
|
43
45
|
//# sourceMappingURL=native.d.ts.map
|
package/dist/native.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH;;;;;;GAMG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAID,gDAAgD;AAChD,eAAO,MAAM,OAAO,gDAAoB,CAAA;AACxC,kDAAkD;AAClD,eAAO,MAAM,EAAE,2CAAe,CAAA;AAC9B,8CAA8C;AAC9C,eAAO,MAAM,KAAK,8CAAkB,CAAA;AACpC,8CAA8C;AAC9C,eAAO,MAAM,KAAK,8CAAkB,CAAA;AACpC,yDAAyD;AACzD,eAAO,MAAM,SAAS,kDAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH;;;;;;GAMG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAID,gDAAgD;AAChD,eAAO,MAAM,OAAO,gDAAoB,CAAA;AACxC,kDAAkD;AAClD,eAAO,MAAM,EAAE,2CAAe,CAAA;AAC9B,8CAA8C;AAC9C,eAAO,MAAM,KAAK,8CAAkB,CAAA;AACpC,8CAA8C;AAC9C,eAAO,MAAM,KAAK,8CAAkB,CAAA;AACpC,yDAAyD;AACzD,eAAO,MAAM,SAAS,kDAAsB,CAAA;AAC5C,iDAAiD;AACjD,eAAO,MAAM,QAAQ,iDAAqB,CAAA;AAE1C,OAAO,EACL,UAAU,EACV,yBAAyB,EACzB,WAAW,EACX,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,SAAS,EACT,EAAE,EACF,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,KAAK,GACN,MAAM,YAAY,CAAA"}
|
package/dist/native.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as BindingNotConfiguredError, i as AlienError,
|
|
1
|
+
import { a as BindingNotConfiguredError, c as UnknownPostgresSslModeError, i as AlienError, l as defineError, n as registerEmbeddedAddon, r as createFactories, s as InvalidPostgresTlsConfigError } from "./loader.js";
|
|
2
2
|
import addon from "./alien-bindings.node";
|
|
3
3
|
//#region src/native.ts
|
|
4
4
|
/**
|
|
@@ -44,5 +44,7 @@ const queue = factories.queue;
|
|
|
44
44
|
const vault = factories.vault;
|
|
45
45
|
/** Resolve the linked-container binding named `name`. */
|
|
46
46
|
const container = factories.container;
|
|
47
|
+
/** Resolve the Postgres binding named `name`. */
|
|
48
|
+
const postgres = factories.postgres;
|
|
47
49
|
//#endregion
|
|
48
|
-
export { AlienError, BindingNotConfiguredError, container, defineError, installEmbeddedAddon, kv, queue, storage, vault };
|
|
50
|
+
export { AlienError, BindingNotConfiguredError, InvalidPostgresTlsConfigError, UnknownPostgresSslModeError, container, defineError, installEmbeddedAddon, kv, postgres, queue, storage, vault };
|
package/dist/types.d.ts
CHANGED
|
@@ -139,6 +139,105 @@ export interface Container {
|
|
|
139
139
|
/** Get the public URL when the container is publicly exposed. */
|
|
140
140
|
getPublicUrl(): Promise<string | null>;
|
|
141
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* TLS mode for a Postgres connection: `disable` for the local developer backend
|
|
144
|
+
* or an explicit BYO plaintext opt-out, `verify-full` for a BYO database with
|
|
145
|
+
* certificate and hostname verification, `verify-ca` for Cloud SQL over its
|
|
146
|
+
* Private Service Connect IP, and `verify-full` for Aurora and Flexible Server.
|
|
147
|
+
*/
|
|
148
|
+
export type PostgresSslMode = "disable" | "verify-ca" | "verify-full";
|
|
149
|
+
/** TLS options for `verify-ca`, where the provider CA authenticates the server. */
|
|
150
|
+
interface PostgresVerifyCaTlsOptions {
|
|
151
|
+
/**
|
|
152
|
+
* One or more PEM-encoded provider CA certificates. `verify-ca` cannot use the
|
|
153
|
+
* operating system trust store because the certificate is specific to the instance.
|
|
154
|
+
*/
|
|
155
|
+
ca: [string, ...string[]];
|
|
156
|
+
/** Always true: an untrusted certificate fails the connection. */
|
|
157
|
+
rejectUnauthorized: true;
|
|
158
|
+
/**
|
|
159
|
+
* Skip hostname matching after the CA chain succeeds because Cloud SQL's
|
|
160
|
+
* certificate does not contain the Private Service Connect IP being dialed.
|
|
161
|
+
*/
|
|
162
|
+
checkServerIdentity: () => undefined;
|
|
163
|
+
}
|
|
164
|
+
/** TLS options for full certificate and hostname verification. */
|
|
165
|
+
interface PostgresVerifyFullTlsOptions {
|
|
166
|
+
/**
|
|
167
|
+
* PEM-encoded provider root CA certificates. Managed backends supply these;
|
|
168
|
+
* an external database can omit them to use the operating system trust store.
|
|
169
|
+
*/
|
|
170
|
+
ca?: string[];
|
|
171
|
+
/** Always true: an untrusted certificate fails the connection. */
|
|
172
|
+
rejectUnauthorized: true;
|
|
173
|
+
/** `verify-full` must never override Node's hostname verification. */
|
|
174
|
+
checkServerIdentity?: never;
|
|
175
|
+
}
|
|
176
|
+
/** Verified TLS options ready to pass to node-postgres. */
|
|
177
|
+
export type PostgresTlsOptions = PostgresVerifyCaTlsOptions | PostgresVerifyFullTlsOptions;
|
|
178
|
+
/** Connection fields shared by every Postgres TLS mode. */
|
|
179
|
+
interface PostgresConnectionFields {
|
|
180
|
+
/**
|
|
181
|
+
* `postgres://user:password@host:port/database?sslmode=<mode>`. The username,
|
|
182
|
+
* password, and database are percent-encoded to the RFC 3986 unreserved set, so a
|
|
183
|
+
* generated password containing URL-special characters can never corrupt the URL.
|
|
184
|
+
*/
|
|
185
|
+
connectionString: string;
|
|
186
|
+
/** Address to dial — the cluster writer endpoint for Aurora, the host elsewhere. */
|
|
187
|
+
host: string;
|
|
188
|
+
/** TCP port. */
|
|
189
|
+
port: number;
|
|
190
|
+
/** Database name. */
|
|
191
|
+
database: string;
|
|
192
|
+
/** Role to connect as. */
|
|
193
|
+
username: string;
|
|
194
|
+
/**
|
|
195
|
+
* Connection password. For the managed cloud backends this was read from the
|
|
196
|
+
* cloud secret store when the binding resolved; the binding itself only ever
|
|
197
|
+
* carries a locator for it.
|
|
198
|
+
*/
|
|
199
|
+
password: string;
|
|
200
|
+
}
|
|
201
|
+
interface PostgresDisableConnection extends PostgresConnectionFields {
|
|
202
|
+
sslmode: "disable";
|
|
203
|
+
ssl: false;
|
|
204
|
+
}
|
|
205
|
+
interface PostgresVerifyCaConnection extends PostgresConnectionFields {
|
|
206
|
+
sslmode: "verify-ca";
|
|
207
|
+
ssl: PostgresVerifyCaTlsOptions;
|
|
208
|
+
}
|
|
209
|
+
interface PostgresVerifyFullConnection extends PostgresConnectionFields {
|
|
210
|
+
sslmode: "verify-full";
|
|
211
|
+
ssl: PostgresVerifyFullTlsOptions;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Everything a Postgres driver needs to connect, discriminated by {@link sslmode}.
|
|
215
|
+
*
|
|
216
|
+
* For node-postgres, pass the individual fields with `ssl` rather than combining
|
|
217
|
+
* `connectionString` and `ssl`. node-postgres parses URL TLS parameters and can
|
|
218
|
+
* overwrite an explicit `ssl` object, including provider roots.
|
|
219
|
+
*
|
|
220
|
+
* External (BYO) bindings default to `verify-full`. A plaintext-only legacy server
|
|
221
|
+
* must be configured explicitly with `sslMode: "disable"` in its external binding.
|
|
222
|
+
*/
|
|
223
|
+
export type PostgresConnection = PostgresDisableConnection | PostgresVerifyCaConnection | PostgresVerifyFullConnection;
|
|
224
|
+
/**
|
|
225
|
+
* A resolved Postgres binding.
|
|
226
|
+
*
|
|
227
|
+
* Unlike the other kinds this exposes no operations: every Postgres backend speaks
|
|
228
|
+
* the same wire protocol, so the binding hands back connection details and the
|
|
229
|
+
* application connects with its own driver.
|
|
230
|
+
*/
|
|
231
|
+
export interface Postgres {
|
|
232
|
+
/**
|
|
233
|
+
* Resolve the connection details.
|
|
234
|
+
*
|
|
235
|
+
* For a managed cloud backend the first call reads the password from that cloud's
|
|
236
|
+
* secret store with the workload's own identity; the resolved value is then reused,
|
|
237
|
+
* so call the factory again to pick up a rotated password.
|
|
238
|
+
*/
|
|
239
|
+
connection(): Promise<PostgresConnection>;
|
|
240
|
+
}
|
|
142
241
|
/** A resolved vault (secrets) binding. */
|
|
143
242
|
export interface Vault {
|
|
144
243
|
/** Get the secret named `name` as a string. */
|
|
@@ -154,4 +253,5 @@ export interface Vault {
|
|
|
154
253
|
/** List the names of all secrets in this vault. */
|
|
155
254
|
list(): Promise<string[]>;
|
|
156
255
|
}
|
|
256
|
+
export {};
|
|
157
257
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|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,CAAC,CAAA;IAC9C,oEAAoE;IACpE,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/C,oEAAoE;IACpE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACpD,sCAAsC;IACtC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,mDAAmD;IACnD,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;CAC1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alienplatform/bindings",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -21,17 +21,6 @@
|
|
|
21
21
|
"node": ">=18",
|
|
22
22
|
"bun": ">=1.0.23"
|
|
23
23
|
},
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "tsdown && tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
26
|
-
"build:addon": "napi build --platform --release --cwd ../../crates/alien-bindings-node",
|
|
27
|
-
"prepare": "npm run build",
|
|
28
|
-
"test": "vitest run",
|
|
29
|
-
"test:bun": "bun scripts/run-bun-tests.mjs",
|
|
30
|
-
"test:ts": "tsc --noEmit",
|
|
31
|
-
"smoke": "node scripts/smoke-envelope.mjs",
|
|
32
|
-
"format-and-lint": "biome check .",
|
|
33
|
-
"format-and-lint:fix": "biome check . --write"
|
|
34
|
-
},
|
|
35
24
|
"keywords": [
|
|
36
25
|
"alien",
|
|
37
26
|
"bindings",
|
|
@@ -39,11 +28,12 @@
|
|
|
39
28
|
"kv",
|
|
40
29
|
"queue",
|
|
41
30
|
"vault",
|
|
31
|
+
"postgres",
|
|
42
32
|
"napi"
|
|
43
33
|
],
|
|
44
34
|
"author": "Alien Software, Inc. <hi@alien.dev>",
|
|
45
35
|
"license": "FSL-1.1-Apache-2.0",
|
|
46
|
-
"description": "Direct TypeScript bindings for Alien storage, kv, queue, and
|
|
36
|
+
"description": "Direct TypeScript bindings for Alien storage, kv, queue, vault, and postgres over an in-process napi-rs addon",
|
|
47
37
|
"homepage": "https://alien.dev",
|
|
48
38
|
"repository": {
|
|
49
39
|
"type": "git",
|
|
@@ -54,22 +44,32 @@
|
|
|
54
44
|
"access": "public"
|
|
55
45
|
},
|
|
56
46
|
"devDependencies": {
|
|
57
|
-
"@alienplatform/typescript-config": "workspace:^",
|
|
58
47
|
"@biomejs/biome": "^1.9.4",
|
|
59
48
|
"@napi-rs/cli": "^3.0.0",
|
|
60
49
|
"@types/node": "^24.0.15",
|
|
61
50
|
"tsdown": "^0.13.0",
|
|
62
51
|
"typescript": "^5.8.3",
|
|
63
52
|
"vitest": "^3.1.4",
|
|
64
|
-
"zod": "4.3.2"
|
|
53
|
+
"zod": "4.3.2",
|
|
54
|
+
"@alienplatform/typescript-config": "^1.0.0"
|
|
65
55
|
},
|
|
66
56
|
"dependencies": {
|
|
67
|
-
"@alienplatform/core": "
|
|
57
|
+
"@alienplatform/core": "^3.3.0"
|
|
68
58
|
},
|
|
69
59
|
"optionalDependencies": {
|
|
70
|
-
"@alienplatform/bindings-darwin-arm64": "3.
|
|
71
|
-
"@alienplatform/bindings-darwin-x64": "3.
|
|
72
|
-
"@alienplatform/bindings-linux-x64-gnu": "3.
|
|
73
|
-
"@alienplatform/bindings-linux-arm64-gnu": "3.
|
|
60
|
+
"@alienplatform/bindings-darwin-arm64": "3.3.0",
|
|
61
|
+
"@alienplatform/bindings-darwin-x64": "3.3.0",
|
|
62
|
+
"@alienplatform/bindings-linux-x64-gnu": "3.3.0",
|
|
63
|
+
"@alienplatform/bindings-linux-arm64-gnu": "3.3.0"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"build": "tsdown && tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
67
|
+
"build:addon": "napi build --platform --release --cwd ../../crates/alien-bindings-node",
|
|
68
|
+
"test": "vitest run",
|
|
69
|
+
"test:bun": "bun scripts/run-bun-tests.mjs",
|
|
70
|
+
"test:ts": "tsc --noEmit",
|
|
71
|
+
"smoke": "node scripts/smoke-envelope.mjs",
|
|
72
|
+
"format-and-lint": "biome check .",
|
|
73
|
+
"format-and-lint:fix": "biome check . --write"
|
|
74
74
|
}
|
|
75
|
-
}
|
|
75
|
+
}
|