@openfn/language-aws-s3 1.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.
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@openfn/language-aws-s3",
3
+ "version": "1.0.0",
4
+ "description": "OpenFn aws-s3 adaptor",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./dist/index.js",
9
+ "types": "./types/index.d.ts",
10
+ "require": "./dist/index.cjs"
11
+ },
12
+ "./package.json": "./package.json"
13
+ },
14
+ "author": "Open Function Group",
15
+ "license": "LGPLv3",
16
+ "files": [
17
+ "dist/",
18
+ "types/",
19
+ "ast.json",
20
+ "configuration-schema.json"
21
+ ],
22
+ "dependencies": {
23
+ "@openfn/language-common": "3.2.3"
24
+ },
25
+ "optionalDependencies": {
26
+ "@aws-sdk/client-s3": "^3.500.0"
27
+ },
28
+ "devDependencies": {
29
+ "assertion-error": "2.0.0",
30
+ "chai": "4.3.6",
31
+ "aws-sdk-client-mock": "^4.1.0",
32
+ "deep-eql": "4.1.1",
33
+ "mocha": "^10.7.3",
34
+ "rimraf": "3.0.2",
35
+ "undici": "^5.22.1"
36
+ },
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "https://github.com/openfn/adaptors.git"
40
+ },
41
+ "types": "types/index.d.ts",
42
+ "main": "dist/index.cjs",
43
+ "scripts": {
44
+ "build": "pnpm clean && build-adaptor aws-s3",
45
+ "test": "mocha --experimental-specifier-resolution=node --no-warnings",
46
+ "test:watch": "mocha -w --experimental-specifier-resolution=node --no-warnings",
47
+ "clean": "rimraf dist types docs",
48
+ "pack": "pnpm pack --pack-destination ../../dist",
49
+ "lint": "eslint src"
50
+ }
51
+ }
@@ -0,0 +1,83 @@
1
+ /**
2
+ * S3 operation input params used by `put`, `get`, and `list`.
3
+ * @typedef {Object} S3Params
4
+ * @property {string} key - Object key for `put`/`get` (required for those ops)
5
+ * @property {any} [body] - Body for `put` (string, Buffer, or stream)
6
+ * @property {string} [bucket] - S3 bucket name (overrides configuration value)
7
+ * @property {string} [contentType] - Optional content type for `put`
8
+ * @property {string} [prefix] - Prefix for `list` operation
9
+ * @property {number} [maxKeys] - Max keys for `list`
10
+ * @property {string} [continuationToken] - Continuation token for `list` pagination
11
+ */
12
+ /**
13
+ * Put an object into S3.
14
+ *
15
+ * @example
16
+ * put({ bucket: 'my-bucket', key: 'path/to/file.txt', body: 'hello' });
17
+ *
18
+ * @public
19
+ * @param {S3Params} params - The S3 operation parameters (bucket. key, body, contentType, etc.)
20
+ * @returns {Operation} - A function that takes the state and performs the put operation.
21
+ */
22
+ export function put(params: S3Params): Operation;
23
+ /**
24
+ * List objects in a bucket (by prefix).
25
+ *
26
+ * @example
27
+ * list({ bucket: 'my-bucket', prefix: 'path/to/' });
28
+ *
29
+ * @public
30
+ * @param {S3Params} params - The S3 operation parameters (bucket, prefix, etc.)
31
+ * @returns {Operation} - A function that takes the state and performs the list operation.
32
+ * @state {Object} state - On success sets `state.data` to the list of objects and `state.response` to the raw S3 response metadata.
33
+ */
34
+ export function list(params?: S3Params): Operation;
35
+ /**
36
+ * Get an object from S3.
37
+ *
38
+ * Attempts to parse JSON objects automatically into `state.data`. For binary
39
+ * objects the adaptor returns base64 in `state.data.base64`.
40
+ *
41
+ * @example
42
+ * get({ bucket: 'my-bucket', key: 'path/to/file.txt' });
43
+ *
44
+ * @public
45
+ * @param {S3Params} params - The S3 operation parameters (bucket, key).
46
+ * @returns {Operation} - A function that takes the state and performs the get operation.
47
+ * @state {Object} state - On success sets `state.data` to the parsed body (or `{ base64: '...' }`) and `state.response` to the raw response metadata.
48
+ */
49
+ export function get(params: S3Params): Operation;
50
+ /**
51
+ * S3 operation input params used by `put`, `get`, and `list`.
52
+ */
53
+ export type S3Params = {
54
+ /**
55
+ * - Object key for `put`/`get` (required for those ops)
56
+ */
57
+ key: string;
58
+ /**
59
+ * - Body for `put` (string, Buffer, or stream)
60
+ */
61
+ body?: any;
62
+ /**
63
+ * - S3 bucket name (overrides configuration value)
64
+ */
65
+ bucket?: string;
66
+ /**
67
+ * - Optional content type for `put`
68
+ */
69
+ contentType?: string;
70
+ /**
71
+ * - Prefix for `list` operation
72
+ */
73
+ prefix?: string;
74
+ /**
75
+ * - Max keys for `list`
76
+ */
77
+ maxKeys?: number;
78
+ /**
79
+ * - Continuation token for `list` pagination
80
+ */
81
+ continuationToken?: string;
82
+ };
83
+ export { as, combine, cursor, dataPath, dataValue, dateFns, each, field, fields, fn, fnIf, group, lastReferenceValue, map, merge, scrubEmojis, sourceValue, util } from "@openfn/language-common";
@@ -0,0 +1,14 @@
1
+ export function prepareNextState(state: any, response: any): any;
2
+ export function s3ClientFromConfig(configuration?: {}): S3Client;
3
+ export function streamToBuffer(stream: any): Promise<Buffer>;
4
+ export function prepareS3GetResponse(response: any): Promise<any>;
5
+ export function preparePutResponse(response: any, Bucket: any, Key: any): {
6
+ body: {
7
+ bucket: any;
8
+ key: any;
9
+ etag: any;
10
+ };
11
+ headers: any;
12
+ statusCode: number;
13
+ };
14
+ import { S3Client } from "@aws-sdk/client-s3/dist-types/S3Client";
@@ -0,0 +1,3 @@
1
+ export default Adaptor;
2
+ export * from "./Adaptor";
3
+ import * as Adaptor from "./Adaptor";