@alienplatform/sdk 1.10.7 → 1.11.1
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/.turbo/turbo-build.log +37 -8
- package/dist/bearerTokenAuthenticationPolicy.js +3028 -0
- package/dist/bindings/index.d.ts +1 -0
- package/dist/bindings/index.d.ts.map +1 -1
- package/dist/bindings/postgres.d.ts +90 -0
- package/dist/bindings/postgres.d.ts.map +1 -0
- package/dist/bindings/postgres.test.d.ts +2 -0
- package/dist/bindings/postgres.test.d.ts.map +1 -0
- package/dist/client.js +2376 -0
- package/dist/commands/index.js +1 -1
- package/dist/dist-cjs.js +3 -0
- package/dist/dist-cjs2.js +718 -0
- package/dist/dist-cjs3.js +2486 -0
- package/dist/dist-cjs4.js +171 -0
- package/dist/dist-cjs5.js +429 -0
- package/dist/dist-cjs6.js +60 -0
- package/dist/dist-cjs7.js +978 -0
- package/dist/dist-cjs8.js +86 -0
- package/dist/dist-cjs9.js +319 -0
- package/dist/dist.js +498 -36
- package/dist/dist2.js +1239 -0
- package/dist/errors.d.ts +25 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/es5.js +1624 -0
- package/dist/esm.js +18211 -0
- package/dist/esm2.js +3104 -0
- package/dist/event-streams.js +203 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +336 -24996
- package/dist/jws.js +611 -0
- package/dist/open.js +460 -0
- package/dist/package.js +4 -0
- package/dist/protocols.js +954 -0
- package/dist/protocols2.js +5565 -0
- package/dist/rolldown-runtime.js +37 -0
- package/dist/serde.js +5542 -0
- package/dist/signin.js +723 -0
- package/dist/src.js +24900 -0
- package/dist/src2.js +114030 -0
- package/dist/sso-oidc.js +940 -0
- package/dist/sts.js +1329 -0
- package/dist/tslib.es6.js +543 -0
- package/package.json +26 -2
- package/src/bindings/index.ts +1 -0
- package/src/bindings/postgres.test.ts +17 -0
- package/src/bindings/postgres.ts +446 -0
- package/src/errors.ts +21 -0
- package/src/index.ts +5 -0
package/dist/bindings/index.d.ts
CHANGED
|
@@ -9,4 +9,5 @@ export { Build } from "./build.js";
|
|
|
9
9
|
export { ArtifactRegistry } from "./artifact-registry.js";
|
|
10
10
|
export { WorkerBinding } from "./worker.js";
|
|
11
11
|
export { ServiceAccount } from "./service-account.js";
|
|
12
|
+
export { getPostgresConnection, type PostgresConnection } from "./postgres.js";
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bindings/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bindings/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,qBAAqB,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Postgres binding accessor.
|
|
3
|
+
*
|
|
4
|
+
* Postgres is connection-only: unlike Storage/Kv/Queue there is no gRPC service to call,
|
|
5
|
+
* so this module does not use {@link AlienContext}. Instead the manager injects the
|
|
6
|
+
* connection details for a linked database into `ALIEN_<NAME>_BINDING` as JSON, and the
|
|
7
|
+
* workload turns them into a live connection here.
|
|
8
|
+
*
|
|
9
|
+
* The cloud variants deliberately carry only a *reference* to the connection password
|
|
10
|
+
* (Secrets Manager ARN / Secret Manager name / Key Vault URI), never the password itself.
|
|
11
|
+
* The workload resolves that reference at runtime using its own least-privilege identity
|
|
12
|
+
* — exactly what the `postgres/data-access` permission set grants — so the password never
|
|
13
|
+
* flows through the control plane or sits as a plaintext environment variable.
|
|
14
|
+
*
|
|
15
|
+
* The matching cloud secret SDK is imported lazily, so a workload only loads the SDK for
|
|
16
|
+
* the cloud it is actually running on.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Everything a Postgres driver needs to connect. `ssl` is the node-postgres TLS value; for
|
|
20
|
+
* node-postgres pass it with the individual fields, not the connectionString (see the `ssl` note).
|
|
21
|
+
* It is a plain value any driver can read.
|
|
22
|
+
*/
|
|
23
|
+
export interface PostgresConnection {
|
|
24
|
+
/**
|
|
25
|
+
* `postgres://user:password@host:port/database?sslmode=<mode>`, with credentials
|
|
26
|
+
* percent-encoded. The `sslmode` mirrors the Rust resolver byte-for-byte (`disable`
|
|
27
|
+
* local, `prefer` external, `require` cloud) so a sslmode-aware consumer agrees with us.
|
|
28
|
+
*/
|
|
29
|
+
connectionString: string;
|
|
30
|
+
/**
|
|
31
|
+
* The TLS setting for the driver: `false` for plaintext-capable bindings (local/external),
|
|
32
|
+
* `{ rejectUnauthorized: false }` for managed clouds (TLS on, cert not yet verified against a
|
|
33
|
+
* pinned CA).
|
|
34
|
+
*
|
|
35
|
+
* For node-postgres, pass this with the individual fields — `new Client({ host, port, ..., ssl })`
|
|
36
|
+
* — NOT with the connectionString. node-postgres parses the URL's `sslmode` (it treats `require`
|
|
37
|
+
* as `verify-full`) and that overwrites an explicit `ssl`, so the URL form rejects the cloud cert
|
|
38
|
+
* with "unable to get local issuer certificate". Field style lets this value take effect.
|
|
39
|
+
*
|
|
40
|
+
* `rejectUnauthorized: false` is a deliberate v1 posture: Postgres is private-only on every cloud
|
|
41
|
+
* (no public IP, reachable only from same-stack workloads), so the network boundary is the primary
|
|
42
|
+
* control and an on-path MITM would already be inside the stack VPC. Verified TLS (provider CAs) is
|
|
43
|
+
* future defense-in-depth, not a v1 requirement.
|
|
44
|
+
*
|
|
45
|
+
* For the `external` (BYO) backend this is always `false`: node-postgres has no `prefer` mode, so
|
|
46
|
+
* the field stays plaintext while the connection string's `sslmode=prefer` only reaches sslmode-aware
|
|
47
|
+
* consumers (psql). A BYO database that *requires* TLS must have TLS configured outside this struct.
|
|
48
|
+
*/
|
|
49
|
+
ssl: false | {
|
|
50
|
+
rejectUnauthorized: boolean;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* The same connection details as individual fields, for drivers that take them separately
|
|
54
|
+
* (`new Client({ host, port, user: username, password, database })`) instead of a URL. These are
|
|
55
|
+
* the un-encoded values that `connectionString` percent-encodes; `host` is the address to dial
|
|
56
|
+
* (the Aurora cluster endpoint for the managed-AWS backend).
|
|
57
|
+
*/
|
|
58
|
+
host: string;
|
|
59
|
+
port: number;
|
|
60
|
+
database: string;
|
|
61
|
+
username: string;
|
|
62
|
+
password: string;
|
|
63
|
+
}
|
|
64
|
+
export declare function encodeUserinfo(value: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Resolves the connection details for a linked Postgres database.
|
|
67
|
+
*
|
|
68
|
+
* @param bindingName The resource id used when the database was linked (e.g. the value
|
|
69
|
+
* passed to `new alien.Postgres(id)`).
|
|
70
|
+
* @returns A connection string plus `ssl`, and the same details as individual fields
|
|
71
|
+
* (`host`/`port`/`database`/`username`/`password`) — use whichever style your driver prefers.
|
|
72
|
+
* @throws AlienError if the binding env var is missing, malformed, or names a backend
|
|
73
|
+
* whose secret resolution is not available in this build.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* import { Client } from "pg"
|
|
78
|
+
* import { getPostgresConnection } from "@alienplatform/sdk"
|
|
79
|
+
*
|
|
80
|
+
* const conn = await getPostgresConnection("my-db")
|
|
81
|
+
* // Field style: node-postgres parses a URL's sslmode and would override `ssl`, so pass fields.
|
|
82
|
+
* const client = new Client({
|
|
83
|
+
* host: conn.host, port: conn.port, database: conn.database,
|
|
84
|
+
* user: conn.username, password: conn.password, ssl: conn.ssl,
|
|
85
|
+
* })
|
|
86
|
+
* await client.connect()
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare function getPostgresConnection(bindingName: string): Promise<PostgresConnection>;
|
|
90
|
+
//# sourceMappingURL=postgres.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/bindings/postgres.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAUH;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAA;IACxB;;;;;;;;;;;;;;;;;;OAkBG;IACH,GAAG,EAAE,KAAK,GAAG;QAAE,kBAAkB,EAAE,OAAO,CAAA;KAAE,CAAA;IAC5C;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB;AA0ED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKpD;AAgCD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAmE5F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres.test.d.ts","sourceRoot":"","sources":["../../src/bindings/postgres.test.ts"],"names":[],"mappings":""}
|