@alienplatform/sdk 1.14.1 → 2.0.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.
Files changed (160) hide show
  1. package/dist/dist.js +371 -275
  2. package/dist/index.d.ts +22 -28
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +3 -14356
  5. package/dist/native.d.ts +26 -0
  6. package/dist/native.d.ts.map +1 -0
  7. package/dist/native.js +2 -0
  8. package/dist/worker-runtime/channel.d.ts +25 -0
  9. package/dist/worker-runtime/channel.d.ts.map +1 -0
  10. package/dist/worker-runtime/errors.d.ts +79 -0
  11. package/dist/worker-runtime/errors.d.ts.map +1 -0
  12. package/dist/worker-runtime/event-loop.d.ts +43 -0
  13. package/dist/worker-runtime/event-loop.d.ts.map +1 -0
  14. package/dist/{generated → worker-runtime/generated}/control.d.ts +15 -15
  15. package/dist/worker-runtime/generated/control.d.ts.map +1 -0
  16. package/dist/worker-runtime/generated/google/protobuf/duration.d.ts.map +1 -0
  17. package/dist/worker-runtime/generated/google/protobuf/timestamp.d.ts.map +1 -0
  18. package/dist/{generated → worker-runtime/generated}/wait_until.d.ts +29 -29
  19. package/dist/worker-runtime/generated/wait_until.d.ts.map +1 -0
  20. package/dist/worker-runtime/grpc-utils.d.ts +23 -0
  21. package/dist/worker-runtime/grpc-utils.d.ts.map +1 -0
  22. package/dist/worker-runtime/index.d.ts +33 -0
  23. package/dist/worker-runtime/index.d.ts.map +1 -0
  24. package/dist/{src.js → worker-runtime/index.js} +9370 -4035
  25. package/dist/worker-runtime/registry.d.ts +169 -0
  26. package/dist/worker-runtime/registry.d.ts.map +1 -0
  27. package/dist/worker-runtime/service-definitions.d.ts +12 -0
  28. package/dist/worker-runtime/service-definitions.d.ts.map +1 -0
  29. package/dist/worker-runtime/wait-until-manager.d.ts +34 -0
  30. package/dist/worker-runtime/wait-until-manager.d.ts.map +1 -0
  31. package/package.json +18 -38
  32. package/.turbo/turbo-build.log +0 -30
  33. package/AGENTS.md +0 -70
  34. package/dist/bearerTokenAuthenticationPolicy.js +0 -3028
  35. package/dist/bindings/artifact-registry.d.ts +0 -88
  36. package/dist/bindings/artifact-registry.d.ts.map +0 -1
  37. package/dist/bindings/build.d.ts +0 -67
  38. package/dist/bindings/build.d.ts.map +0 -1
  39. package/dist/bindings/index.d.ts +0 -13
  40. package/dist/bindings/index.d.ts.map +0 -1
  41. package/dist/bindings/kv.d.ts +0 -113
  42. package/dist/bindings/kv.d.ts.map +0 -1
  43. package/dist/bindings/postgres.d.ts +0 -90
  44. package/dist/bindings/postgres.d.ts.map +0 -1
  45. package/dist/bindings/postgres.test.d.ts +0 -2
  46. package/dist/bindings/postgres.test.d.ts.map +0 -1
  47. package/dist/bindings/queue.d.ts +0 -81
  48. package/dist/bindings/queue.d.ts.map +0 -1
  49. package/dist/bindings/service-account.d.ts +0 -46
  50. package/dist/bindings/service-account.d.ts.map +0 -1
  51. package/dist/bindings/storage.d.ts +0 -164
  52. package/dist/bindings/storage.d.ts.map +0 -1
  53. package/dist/bindings/vault.d.ts +0 -65
  54. package/dist/bindings/vault.d.ts.map +0 -1
  55. package/dist/bindings/worker.d.ts +0 -72
  56. package/dist/bindings/worker.d.ts.map +0 -1
  57. package/dist/channel.d.ts +0 -39
  58. package/dist/channel.d.ts.map +0 -1
  59. package/dist/checksum.js +0 -6176
  60. package/dist/commands/client.d.ts +0 -47
  61. package/dist/commands/client.d.ts.map +0 -1
  62. package/dist/commands/errors.d.ts +0 -198
  63. package/dist/commands/errors.d.ts.map +0 -1
  64. package/dist/commands/index.d.ts +0 -23
  65. package/dist/commands/index.d.ts.map +0 -1
  66. package/dist/commands/index.js +0 -387
  67. package/dist/commands/types.d.ts +0 -40
  68. package/dist/commands/types.d.ts.map +0 -1
  69. package/dist/commands.d.ts +0 -55
  70. package/dist/commands.d.ts.map +0 -1
  71. package/dist/context.d.ts +0 -182
  72. package/dist/context.d.ts.map +0 -1
  73. package/dist/dist-cjs.js +0 -15258
  74. package/dist/dist2.js +0 -1239
  75. package/dist/errors.d.ts +0 -359
  76. package/dist/errors.d.ts.map +0 -1
  77. package/dist/es5.js +0 -1720
  78. package/dist/esm.js +0 -18068
  79. package/dist/esm2.js +0 -3166
  80. package/dist/event-streams.js +0 -770
  81. package/dist/events.d.ts +0 -163
  82. package/dist/events.d.ts.map +0 -1
  83. package/dist/generated/artifact_registry.d.ts +0 -302
  84. package/dist/generated/artifact_registry.d.ts.map +0 -1
  85. package/dist/generated/build.d.ts +0 -184
  86. package/dist/generated/build.d.ts.map +0 -1
  87. package/dist/generated/container.d.ts +0 -101
  88. package/dist/generated/container.d.ts.map +0 -1
  89. package/dist/generated/control.d.ts.map +0 -1
  90. package/dist/generated/google/protobuf/duration.d.ts.map +0 -1
  91. package/dist/generated/google/protobuf/timestamp.d.ts.map +0 -1
  92. package/dist/generated/kv.d.ts +0 -182
  93. package/dist/generated/kv.d.ts.map +0 -1
  94. package/dist/generated/queue.d.ts +0 -127
  95. package/dist/generated/queue.d.ts.map +0 -1
  96. package/dist/generated/service_account.d.ts +0 -112
  97. package/dist/generated/service_account.d.ts.map +0 -1
  98. package/dist/generated/storage.d.ts +0 -784
  99. package/dist/generated/storage.d.ts.map +0 -1
  100. package/dist/generated/vault.d.ts +0 -107
  101. package/dist/generated/vault.d.ts.map +0 -1
  102. package/dist/generated/wait_until.d.ts.map +0 -1
  103. package/dist/generated/worker.d.ts +0 -107
  104. package/dist/generated/worker.d.ts.map +0 -1
  105. package/dist/global.d.ts +0 -208
  106. package/dist/global.d.ts.map +0 -1
  107. package/dist/grpc-utils.d.ts +0 -25
  108. package/dist/grpc-utils.d.ts.map +0 -1
  109. package/dist/jws.js +0 -611
  110. package/dist/open.js +0 -461
  111. package/dist/rolldown-runtime.js +0 -44
  112. package/dist/src2.js +0 -114032
  113. package/dist/types.d.ts +0 -337
  114. package/dist/types.d.ts.map +0 -1
  115. package/dist/wait-until.d.ts +0 -115
  116. package/dist/wait-until.d.ts.map +0 -1
  117. package/scripts/generate-proto.sh +0 -46
  118. package/src/bindings/AGENTS.md +0 -105
  119. package/src/bindings/artifact-registry.ts +0 -317
  120. package/src/bindings/build.ts +0 -195
  121. package/src/bindings/index.ts +0 -13
  122. package/src/bindings/kv.ts +0 -240
  123. package/src/bindings/postgres.test.ts +0 -17
  124. package/src/bindings/postgres.ts +0 -446
  125. package/src/bindings/queue.ts +0 -191
  126. package/src/bindings/service-account.ts +0 -113
  127. package/src/bindings/storage.ts +0 -536
  128. package/src/bindings/vault.ts +0 -133
  129. package/src/bindings/worker.ts +0 -164
  130. package/src/channel.ts +0 -102
  131. package/src/commands/client.ts +0 -446
  132. package/src/commands/errors.ts +0 -126
  133. package/src/commands/index.ts +0 -41
  134. package/src/commands/types.ts +0 -52
  135. package/src/commands.ts +0 -76
  136. package/src/context.ts +0 -368
  137. package/src/errors.ts +0 -280
  138. package/src/events.ts +0 -511
  139. package/src/generated/artifact_registry.ts +0 -2096
  140. package/src/generated/build.ts +0 -1311
  141. package/src/generated/container.ts +0 -503
  142. package/src/generated/control.ts +0 -2018
  143. package/src/generated/google/protobuf/duration.ts +0 -196
  144. package/src/generated/google/protobuf/timestamp.ts +0 -226
  145. package/src/generated/kv.ts +0 -1169
  146. package/src/generated/queue.ts +0 -753
  147. package/src/generated/service_account.ts +0 -814
  148. package/src/generated/storage.ts +0 -3820
  149. package/src/generated/vault.ts +0 -543
  150. package/src/generated/wait_until.ts +0 -829
  151. package/src/generated/worker.ts +0 -759
  152. package/src/global.ts +0 -287
  153. package/src/grpc-utils.ts +0 -159
  154. package/src/index.ts +0 -160
  155. package/src/types.ts +0 -397
  156. package/src/wait-until.ts +0 -273
  157. package/tsconfig.json +0 -8
  158. package/tsdown.config.ts +0 -17
  159. /package/dist/{generated → worker-runtime/generated}/google/protobuf/duration.d.ts +0 -0
  160. /package/dist/{generated → worker-runtime/generated}/google/protobuf/timestamp.d.ts +0 -0
@@ -1,88 +0,0 @@
1
- /**
2
- * ArtifactRegistry binding implementation.
3
- *
4
- * Provides container image repository management.
5
- */
6
- import { type Channel } from "nice-grpc";
7
- import type { ArtifactRegistryCredentials, ArtifactRegistryPermissions, CrossAccountAccess, CrossAccountPermissions, RepositoryInfo } from "../types.js";
8
- /**
9
- * ArtifactRegistry binding for container repository management.
10
- *
11
- * @example
12
- * ```typescript
13
- * import { artifactRegistry } from "@alienplatform/sdk"
14
- *
15
- * const registry = artifactRegistry("my-registry")
16
- *
17
- * // Create a repository
18
- * const repo = await registry.createRepository("my-app")
19
- * console.log("Repository URI:", repo.uri)
20
- *
21
- * // Generate push credentials
22
- * const creds = await registry.generateCredentials("my-app", "push-pull")
23
- * console.log("Username:", creds.username)
24
- * ```
25
- */
26
- export declare class ArtifactRegistry {
27
- private readonly client;
28
- private readonly bindingName;
29
- constructor(channel: Channel, bindingName: string);
30
- /**
31
- * Create a repository.
32
- *
33
- * @param repoName - Name of the repository
34
- * @returns Repository information
35
- */
36
- createRepository(repoName: string): Promise<RepositoryInfo>;
37
- /**
38
- * Get repository details.
39
- *
40
- * @param repoId - Repository ID
41
- * @returns Repository information
42
- */
43
- getRepository(repoId: string): Promise<RepositoryInfo>;
44
- /**
45
- * Add cross-account access to a repository.
46
- *
47
- * @param repoId - Repository ID
48
- * @param access - Cross-account access configuration
49
- */
50
- addCrossAccountAccess(repoId: string, access: CrossAccountAccess): Promise<void>;
51
- /**
52
- * Remove cross-account access from a repository.
53
- *
54
- * @param repoId - Repository ID
55
- * @param access - Cross-account access configuration to remove
56
- */
57
- removeCrossAccountAccess(repoId: string, access: CrossAccountAccess): Promise<void>;
58
- /**
59
- * Get current cross-account access permissions for a repository.
60
- *
61
- * @param repoId - Repository ID
62
- * @returns Current cross-account permissions
63
- */
64
- getCrossAccountAccess(repoId: string): Promise<CrossAccountPermissions>;
65
- /**
66
- * Generate credentials for repository access.
67
- *
68
- * @param repoId - Repository ID
69
- * @param permissions - Permission level (pull or push-pull)
70
- * @param ttlSeconds - Optional TTL in seconds
71
- * @returns Repository credentials
72
- */
73
- generateCredentials(repoId: string, permissions: ArtifactRegistryPermissions, ttlSeconds?: number): Promise<ArtifactRegistryCredentials>;
74
- /**
75
- * Delete a repository.
76
- *
77
- * @param repoId - Repository ID
78
- */
79
- deleteRepository(repoId: string): Promise<void>;
80
- private fromProtoResult;
81
- private fromProtoCredentials;
82
- private toProtoCrossAccountAccess;
83
- private fromProtoCrossAccountAccess;
84
- private fromProtoCrossAccountPermissions;
85
- private computeServiceTypeToProto;
86
- private protoToComputeServiceType;
87
- }
88
- //# sourceMappingURL=artifact-registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"artifact-registry.d.ts","sourceRoot":"","sources":["../../src/bindings/artifact-registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,WAAW,CAAA;AAYtD,OAAO,KAAK,EACV,2BAA2B,EAC3B,2BAA2B,EAE3B,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACf,MAAM,aAAa,CAAA;AAQpB;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;gBAExB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM;IAKjD;;;;;OAKG;IACG,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAejE;;;;;OAKG;IACG,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAe5D;;;;;OAKG;IACG,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAetF;;;;;OAKG;IACG,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAezF;;;;;OAKG;IACG,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAe7E;;;;;;;OAOG;IACG,mBAAmB,CACvB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,2BAA2B,EACxC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,2BAA2B,CAAC;IAiBvC;;;;OAIG;IACG,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBrD,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,yBAAyB;IA0BjC,OAAO,CAAC,2BAA2B;IA6BnC,OAAO,CAAC,gCAAgC;IAYxC,OAAO,CAAC,yBAAyB;IASjC,OAAO,CAAC,yBAAyB;CAQlC"}
@@ -1,67 +0,0 @@
1
- /**
2
- * Build binding implementation.
3
- *
4
- * Provides build execution capabilities.
5
- */
6
- import { type Channel } from "nice-grpc";
7
- import type { BuildExecution, BuildStartConfig } from "../types.js";
8
- /**
9
- * Build binding for executing build operations.
10
- *
11
- * @example
12
- * ```typescript
13
- * import { build } from "@alienplatform/sdk"
14
- *
15
- * const builder = build("my-builder")
16
- *
17
- * // Start a build
18
- * const execution = await builder.start({
19
- * script: "npm run build",
20
- * computeType: "medium",
21
- * timeoutSeconds: 600,
22
- * })
23
- *
24
- * // Wait for completion
25
- * const result = await builder.waitForCompletion(execution.id)
26
- * console.log("Build status:", result.status)
27
- * ```
28
- */
29
- export declare class Build {
30
- private readonly client;
31
- private readonly bindingName;
32
- constructor(channel: Channel, bindingName: string);
33
- /**
34
- * Start a new build.
35
- *
36
- * @param config - Build configuration
37
- * @returns Build execution information
38
- */
39
- start(config: BuildStartConfig): Promise<BuildExecution>;
40
- /**
41
- * Get the status of a build.
42
- *
43
- * @param buildId - Build execution ID
44
- * @returns Build execution information
45
- */
46
- getStatus(buildId: string): Promise<BuildExecution>;
47
- /**
48
- * Stop a running build.
49
- *
50
- * @param buildId - Build execution ID
51
- */
52
- stop(buildId: string): Promise<void>;
53
- /**
54
- * Wait for a build to complete.
55
- *
56
- * @param buildId - Build execution ID
57
- * @param options - Polling options
58
- * @returns Final build execution information
59
- */
60
- waitForCompletion(buildId: string, options?: {
61
- pollIntervalMs?: number;
62
- timeoutMs?: number;
63
- }): Promise<BuildExecution>;
64
- private toProtoConfig;
65
- private fromProtoExecution;
66
- }
67
- //# sourceMappingURL=build.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/bindings/build.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,WAAW,CAAA;AAUtD,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAqBnE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,KAAK;IAChB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6B;IACpD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;gBAExB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM;IAKjD;;;;;OAKG;IACG,KAAK,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC;IAiB9D;;;;;OAKG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAezD;;;;OAIG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc1C;;;;;;OAMG;IACG,iBAAiB,CACrB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GACxD,OAAO,CAAC,cAAc,CAAC;IAyB1B,OAAO,CAAC,aAAa;IAoBrB,OAAO,CAAC,kBAAkB;CAQ3B"}
@@ -1,13 +0,0 @@
1
- /**
2
- * Binding exports.
3
- */
4
- export { Storage } from "./storage.js";
5
- export { Kv } from "./kv.js";
6
- export { Queue } from "./queue.js";
7
- export { Vault } from "./vault.js";
8
- export { Build } from "./build.js";
9
- export { ArtifactRegistry } from "./artifact-registry.js";
10
- export { WorkerBinding } from "./worker.js";
11
- export { ServiceAccount } from "./service-account.js";
12
- export { getPostgresConnection, type PostgresConnection } from "./postgres.js";
13
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,113 +0,0 @@
1
- /**
2
- * KV binding implementation.
3
- *
4
- * Provides key-value storage operations with TTL support.
5
- */
6
- import { type Channel } from "nice-grpc";
7
- import type { KvPutOptions, KvScanResult } from "../types.js";
8
- /**
9
- * KV binding for key-value storage operations.
10
- *
11
- * @example
12
- * ```typescript
13
- * import { kv } from "@alienplatform/sdk"
14
- *
15
- * const cache = kv("my-cache")
16
- *
17
- * // Set a value
18
- * await cache.set("user:123", { name: "John", email: "john@example.com" })
19
- *
20
- * // Get a value
21
- * const user = await cache.getJson<User>("user:123")
22
- *
23
- * // Set with TTL (expires in 1 hour)
24
- * await cache.set("session:abc", sessionData, { ttlMs: 60 * 60 * 1000 })
25
- *
26
- * // Delete
27
- * await cache.delete("user:123")
28
- *
29
- * // Scan by prefix
30
- * for await (const { key, value } of cache.scan("user:")) {
31
- * console.log(key, value)
32
- * }
33
- * ```
34
- */
35
- export declare class Kv {
36
- private readonly client;
37
- private readonly bindingName;
38
- constructor(channel: Channel, bindingName: string);
39
- /**
40
- * Get a value by key.
41
- *
42
- * @param key - Key to retrieve
43
- * @returns Value as Uint8Array, or undefined if not found
44
- */
45
- get(key: string): Promise<Uint8Array | undefined>;
46
- /**
47
- * Get a value as a UTF-8 string.
48
- *
49
- * @param key - Key to retrieve
50
- * @returns Value as string, or undefined if not found
51
- */
52
- getText(key: string): Promise<string | undefined>;
53
- /**
54
- * Get a value and parse as JSON.
55
- *
56
- * @param key - Key to retrieve
57
- * @returns Parsed JSON value, or undefined if not found
58
- */
59
- getJson<T = unknown>(key: string): Promise<T | undefined>;
60
- /**
61
- * Set a value.
62
- *
63
- * @param key - Key to store
64
- * @param value - Value to store (string, Uint8Array, or object for JSON)
65
- * @param options - Optional put options (TTL, ifNotExists)
66
- * @returns True if stored, false if ifNotExists was true and key already exists
67
- */
68
- set(key: string, value: string | Uint8Array | object, options?: KvPutOptions): Promise<boolean>;
69
- /**
70
- * Delete a key.
71
- *
72
- * @param key - Key to delete
73
- */
74
- delete(key: string): Promise<void>;
75
- /**
76
- * Check if a key exists.
77
- *
78
- * @param key - Key to check
79
- * @returns True if the key exists
80
- */
81
- exists(key: string): Promise<boolean>;
82
- /**
83
- * Scan keys with a prefix.
84
- *
85
- * @param prefix - Prefix to scan for
86
- * @param options - Optional scan options (limit)
87
- * @returns Async iterable of key-value pairs
88
- *
89
- * @example
90
- * ```typescript
91
- * // Scan all users
92
- * for await (const { key, value } of cache.scan("user:")) {
93
- * console.log(key, new TextDecoder().decode(value))
94
- * }
95
- * ```
96
- */
97
- scan(prefix: string, options?: {
98
- limit?: number;
99
- }): AsyncIterable<{
100
- key: string;
101
- value: Uint8Array;
102
- }>;
103
- /**
104
- * Scan a single page of results.
105
- *
106
- * @param prefix - Prefix to scan for
107
- * @param limit - Maximum items to return
108
- * @param cursor - Pagination cursor
109
- * @returns Scan result with items and next cursor
110
- */
111
- scanPage(prefix: string, limit?: number, cursor?: string): Promise<KvScanResult>;
112
- }
113
- //# sourceMappingURL=kv.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"kv.d.ts","sourceRoot":"","sources":["../../src/bindings/kv.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,WAAW,CAAA;AAMtD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,EAAE;IACb,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IACjD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;gBAExB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM;IAKjD;;;;;OAKG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAevD;;;;;OAKG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAKvD;;;;;OAKG;IACG,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAK/D;;;;;;;OAOG;IACG,GAAG,CACP,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,EACnC,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,OAAO,CAAC;IAgCnB;;;;OAIG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAcxC;;;;;OAKG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAe3C;;;;;;;;;;;;;;OAcG;IACI,IAAI,CACT,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAC3B,aAAa,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,CAAC;IAcpD;;;;;;;OAOG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;CAsBvF"}
@@ -1,90 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=postgres.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"postgres.test.d.ts","sourceRoot":"","sources":["../../src/bindings/postgres.test.ts"],"names":[],"mappings":""}
@@ -1,81 +0,0 @@
1
- /**
2
- * Queue binding implementation.
3
- *
4
- * Provides message queue operations for async task processing.
5
- */
6
- import { type Channel } from "nice-grpc";
7
- import type { ReceivedQueueMessage } from "../types.js";
8
- /**
9
- * Queue binding for message queue operations.
10
- *
11
- * @example
12
- * ```typescript
13
- * import { queue } from "@alienplatform/sdk"
14
- *
15
- * const tasks = queue("task-queue")
16
- *
17
- * // Send a message (JSON)
18
- * await tasks.send("process-image", { imageId: "123", format: "webp" })
19
- *
20
- * // Receive messages
21
- * const messages = await tasks.receive("process-image", 10)
22
- * for (const msg of messages) {
23
- * await processImage(msg.payload)
24
- * await tasks.ack("process-image", msg.receiptHandle)
25
- * }
26
- * ```
27
- */
28
- export declare class Queue {
29
- private readonly client;
30
- private readonly bindingName;
31
- constructor(channel: Channel, bindingName: string);
32
- /**
33
- * Send a message to a queue.
34
- *
35
- * @param queueName - Name of the queue
36
- * @param payload - Message payload (object for JSON, string for text)
37
- */
38
- send(queueName: string, payload: unknown): Promise<void>;
39
- /**
40
- * Send a text message to a queue.
41
- *
42
- * @param queueName - Name of the queue
43
- * @param text - Text message
44
- */
45
- sendText(queueName: string, text: string): Promise<void>;
46
- /**
47
- * Receive messages from a queue.
48
- *
49
- * @param queueName - Name of the queue
50
- * @param maxMessages - Maximum number of messages to receive (1-10)
51
- * @returns Array of messages with receipt handles
52
- */
53
- receive<T = unknown>(queueName: string, maxMessages?: number): Promise<ReceivedQueueMessage<T>[]>;
54
- /**
55
- * Acknowledge a message (remove it from the queue).
56
- *
57
- * @param queueName - Name of the queue
58
- * @param receiptHandle - Receipt handle from the received message
59
- */
60
- ack(queueName: string, receiptHandle: string): Promise<void>;
61
- /**
62
- * Process messages from a queue with automatic acknowledgment.
63
- *
64
- * @param queueName - Name of the queue
65
- * @param handler - Handler function for each message
66
- * @param options - Processing options
67
- *
68
- * @example
69
- * ```typescript
70
- * await tasks.process("image-tasks", async (payload) => {
71
- * await processImage(payload.imageId)
72
- * })
73
- * ```
74
- */
75
- process<T = unknown>(queueName: string, handler: (payload: T) => Promise<void>, options?: {
76
- maxMessages?: number;
77
- }): Promise<void>;
78
- private toProtoPayload;
79
- private fromProtoMessage;
80
- }
81
- //# sourceMappingURL=queue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/bindings/queue.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,WAAW,CAAA;AAQtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEvD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,KAAK;IAChB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6B;IACpD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;gBAExB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM;IAKjD;;;;;OAKG;IACG,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB9D;;;;;OAKG;IACG,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAe9D;;;;;;OAMG;IACG,OAAO,CAAC,CAAC,GAAG,OAAO,EACvB,SAAS,EAAE,MAAM,EACjB,WAAW,SAAI,GACd,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC;IAgBrC;;;;;OAKG;IACG,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAelE;;;;;;;;;;;;;OAaG;IACG,OAAO,CAAC,CAAC,GAAG,OAAO,EACvB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,EACtC,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GACjC,OAAO,CAAC,IAAI,CAAC;IAahB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,gBAAgB;CAgBzB"}
@@ -1,46 +0,0 @@
1
- /**
2
- * ServiceAccount binding implementation.
3
- *
4
- * Provides identity and impersonation capabilities.
5
- */
6
- import { type Channel } from "nice-grpc";
7
- import type { ImpersonationRequest, ServiceAccountInfo } from "../types.js";
8
- /**
9
- * ServiceAccount binding for identity and impersonation.
10
- *
11
- * @example
12
- * ```typescript
13
- * import { serviceAccount } from "@alienplatform/sdk"
14
- *
15
- * const sa = serviceAccount("deployment-account")
16
- *
17
- * // Get account info
18
- * const info = await sa.getInfo()
19
- * if (info.platform === "aws") {
20
- * console.log("Role ARN:", info.roleArn)
21
- * }
22
- *
23
- * // Impersonate the service account
24
- * const config = await sa.impersonate({ durationSeconds: 3600 })
25
- * ```
26
- */
27
- export declare class ServiceAccount {
28
- private readonly client;
29
- private readonly bindingName;
30
- constructor(channel: Channel, bindingName: string);
31
- /**
32
- * Get information about the service account.
33
- *
34
- * @returns Platform-specific service account information
35
- */
36
- getInfo(): Promise<ServiceAccountInfo>;
37
- /**
38
- * Impersonate the service account.
39
- *
40
- * @param request - Impersonation options
41
- * @returns Client configuration for the impersonated identity
42
- */
43
- impersonate(request?: ImpersonationRequest): Promise<unknown>;
44
- private fromProtoInfo;
45
- }
46
- //# sourceMappingURL=service-account.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service-account.d.ts","sourceRoot":"","sources":["../../src/bindings/service-account.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,WAAW,CAAA;AAOtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAE3E;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;gBAExB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM;IAKjD;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAc5C;;;;;OAKG;IACG,WAAW,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC;IAmBnE,OAAO,CAAC,aAAa;CAyBtB"}