@shivam995364/uplink-nodejs-test 0.1.0-beta.6 → 0.1.0-beta.7

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/Makefile CHANGED
@@ -128,6 +128,37 @@ GO_ARCH_x64 := amd64
128
128
  GO_ARCH_arm64 := arm64
129
129
  GO_ARCH := $(GO_ARCH_$(EFFECTIVE_ARCH))
130
130
 
131
+ # ─── Persistent install method (.uplinkrc) ───────────────────────────────────
132
+ # If UPLINK_INSTALL is not set, check for a saved method in .uplinkrc.
133
+ # The .uplinkrc file lives in the consumer's project root (INIT_CWD), NOT inside
134
+ # node_modules, so it survives `rm -rf node_modules && npm install`.
135
+ #
136
+ # Priority: UPLINK_INSTALL env var > .uplinkrc file > auto-detect
137
+ #
138
+ # INIT_CWD is set by npm/yarn/pnpm to the directory where the user ran npm install.
139
+ # When running make directly (not via npm), INIT_CWD won't be set, so we skip.
140
+ UPLINKRC_DIR := $(or $(INIT_CWD),$(CURDIR))
141
+ UPLINKRC_FILE := $(UPLINKRC_DIR)/.uplinkrc
142
+
143
+ ifndef UPLINK_INSTALL
144
+ # Try to read saved method from .uplinkrc
145
+ _SAVED_METHOD := $(shell cat "$(UPLINKRC_FILE)" 2>/dev/null | tr -d '[:space:]')
146
+ ifneq ($(_SAVED_METHOD),)
147
+ # Validate: only accept known values
148
+ ifneq ($(filter $(_SAVED_METHOD),prebuilt hybrid source skip),)
149
+ UPLINK_INSTALL := $(_SAVED_METHOD)
150
+ _UPLINK_FROM_RC := 1
151
+ $(info [uplink-nodejs] .uplinkrc found at $(UPLINKRC_FILE) → method="$(_SAVED_METHOD)")
152
+ else
153
+ $(info [uplink-nodejs] .uplinkrc found but contains invalid value "$(_SAVED_METHOD)" — ignoring)
154
+ endif
155
+ else
156
+ $(info [uplink-nodejs] No .uplinkrc found at $(UPLINKRC_FILE) — will auto-detect)
157
+ endif
158
+ else
159
+ $(info [uplink-nodejs] UPLINK_INSTALL="$(UPLINK_INSTALL)" set via env — .uplinkrc skipped)
160
+ endif
161
+
131
162
  # Default target
132
163
  .PHONY: all
133
164
  all: prebuild build
@@ -375,15 +406,58 @@ npm-install:
375
406
  # UPLINK_INSTALL=source npm install pkg # source build
376
407
  .PHONY: install
377
408
  install:
409
+ @echo ""
410
+ @echo "╔══════════════════════════════════════════════════════════════╗"
411
+ @echo "║ uplink-nodejs — Native Module Installer ║"
412
+ @echo "╚══════════════════════════════════════════════════════════════╝"
413
+ @echo ""
414
+ @echo " Package version : $(ADDON_VERSION)"
415
+ @echo " Uplink-C version: $(UPLINK_C_VERSION)"
416
+ @echo " Platform : $(PLATFORM)"
417
+ @echo " OS : $(DETECTED_OS)"
418
+ @echo " Architecture : $(DETECTED_ARCH)"
419
+ @echo " Node.js : $$(node --version 2>/dev/null || echo 'not found')"
420
+ ifdef _UPLINK_FROM_RC
421
+ @echo " Install method : $(UPLINK_INSTALL) (from $(UPLINKRC_FILE))"
422
+ else
423
+ @echo " Install method : $(or $(UPLINK_INSTALL),auto)"
424
+ endif
425
+ @echo " Prebuilds dir : $(PLATFORM_DIR)"
426
+ @echo ""
378
427
  ifeq ($(UPLINK_INSTALL),prebuilt)
428
+ @echo "[uplink-nodejs] Method: prebuilt (using shipped binaries)"
429
+ @echo ""
379
430
  @$(MAKE) install-prebuilt-shipped
431
+ ifndef _UPLINK_FROM_RC
432
+ @echo "$(UPLINK_INSTALL)" > "$(UPLINKRC_FILE)" 2>/dev/null && \
433
+ echo "[uplink-nodejs] ✔ Saved install method to $(UPLINKRC_FILE)" || true
434
+ endif
380
435
  else ifeq ($(UPLINK_INSTALL),hybrid)
436
+ @echo "[uplink-nodejs] Method: hybrid (download lib + compile addon)"
437
+ @echo ""
381
438
  @$(MAKE) install-hybrid
439
+ ifndef _UPLINK_FROM_RC
440
+ @echo "$(UPLINK_INSTALL)" > "$(UPLINKRC_FILE)" 2>/dev/null && \
441
+ echo "[uplink-nodejs] ✔ Saved install method to $(UPLINKRC_FILE)" || true
442
+ endif
382
443
  else ifeq ($(UPLINK_INSTALL),source)
444
+ @echo "[uplink-nodejs] Method: source (full build from source)"
445
+ @echo ""
383
446
  @$(MAKE) install-source
447
+ ifndef _UPLINK_FROM_RC
448
+ @echo "$(UPLINK_INSTALL)" > "$(UPLINKRC_FILE)" 2>/dev/null && \
449
+ echo "[uplink-nodejs] ✔ Saved install method to $(UPLINKRC_FILE)" || true
450
+ endif
384
451
  else ifeq ($(UPLINK_INSTALL),skip)
385
- $(Q)echo "[uplink-nodejs] Skipping native build (UPLINK_INSTALL=skip)"
452
+ @echo "[uplink-nodejs] Method: skip — skipping native build"
453
+ @echo ""
454
+ ifndef _UPLINK_FROM_RC
455
+ @echo "$(UPLINK_INSTALL)" > "$(UPLINKRC_FILE)" 2>/dev/null && \
456
+ echo "[uplink-nodejs] ✔ Saved install method to $(UPLINKRC_FILE)" || true
457
+ endif
386
458
  else
459
+ @echo "[uplink-nodejs] Method: auto-detect (prebuilt → hybrid → source)"
460
+ @echo ""
387
461
  @$(MAKE) install-auto
388
462
  endif
389
463
 
@@ -860,14 +934,29 @@ endif
860
934
  # Order: prebuilt-shipped → hybrid → source
861
935
  .PHONY: install-auto
862
936
  install-auto:
863
- $(Q)echo ""
864
- $(Q)echo "╔══════════════════════════════════════════════════════════════╗"
865
- $(Q)echo "║ Auto-detecting best installation method... ║"
866
- $(Q)echo "╚══════════════════════════════════════════════════════════════╝"
867
- $(Q)echo ""
937
+ @echo ""
938
+ @echo "╔══════════════════════════════════════════════════════════════╗"
939
+ @echo "║ Auto-detecting best installation method... ║"
940
+ @echo "╚══════════════════════════════════════════════════════════════╝"
941
+ @echo ""
942
+ @echo "[uplink-nodejs] Step 1: Trying prebuilt shipped binaries..."
868
943
  @$(MAKE) install-prebuilt-shipped 2>/dev/null \
869
- || $(MAKE) install-hybrid 2>/dev/null \
870
- || $(MAKE) install-source
944
+ && echo "" \
945
+ && echo "[uplink-nodejs] ✓ Prebuilt shipped binaries — success" \
946
+ || ( \
947
+ echo "[uplink-nodejs] ✗ Prebuilt shipped binaries not available"; \
948
+ echo ""; \
949
+ echo "[uplink-nodejs] Step 2: Trying hybrid build (download lib + compile addon)..."; \
950
+ $(MAKE) install-hybrid 2>&1 \
951
+ && echo "" \
952
+ && echo "[uplink-nodejs] ✓ Hybrid build — success" \
953
+ || ( \
954
+ echo "[uplink-nodejs] ✗ Hybrid build failed"; \
955
+ echo ""; \
956
+ echo "[uplink-nodejs] Step 3: Trying full source build..."; \
957
+ $(MAKE) install-source \
958
+ ) \
959
+ )
871
960
 
872
961
  # ------------------------------------------------------------------------------
873
962
  # Verification
package/README.md CHANGED
@@ -4,86 +4,82 @@ Node.js native bindings for [Storj's](https://www.storj.io) uplink-c library —
4
4
 
5
5
  ## Installation
6
6
 
7
+ ### Quick Install (auto-detect)
8
+
7
9
  ```bash
8
10
  npm install @shivam995364/uplink-nodejs-test
9
11
  ```
10
12
 
11
- After `npm install`, the package automatically tries to build the native addon. If it can't (e.g. no C compiler or no `make`), it exits gracefully — you can build later using one of the methods below.
12
-
13
- ### Installation Methods
14
-
15
- There are **3 ways** to install the native binaries, depending on your environment:
13
+ By default, `npm install` **auto-detects** the best installation method:
14
+ **prebuilt** (shipped binaries) → **hybrid** (compile addon) → **source** (full build).
16
15
 
17
- | # | Method | Command | Requirements | Speed |
18
- |---|--------|---------|-------------|-------|
19
- | 1 | **Prebuilt** | `make install-prebuilt` | Node.js, curl | ⚡ Fastest |
20
- | 2 | **Hybrid** *(default)* | `make install-hybrid` | Node.js, C compiler, curl | 🔧 Recommended |
21
- | 3 | **Source** | `make install-source` | Node.js, Go, C compiler, Git | 🛠️ Full control |
16
+ If prebuilt binaries are shipped for your platform (macOS arm64, Windows x64), it completes instantly with **zero compilation**.
22
17
 
23
- #### Option 1: Prebuilt (no compilation)
18
+ ---
24
19
 
25
- Downloads both the `libuplink` shared library **and** the prebuilt `.node` addon from GitHub Releases. No compiler needed.
26
-
27
- ```bash
28
- npm install @shivam995364/uplink-nodejs-test
29
- cd node_modules/@shivam995364/uplink-nodejs-test
30
- make install-prebuilt
31
- ```
20
+ ### Choose Installation Method
32
21
 
33
- Or via npm script:
22
+ Set the `UPLINK_INSTALL` environment variable to pick a specific method — **all in one command**:
34
23
 
35
24
  ```bash
36
- npm run install:prebuilt
37
- ```
25
+ # Use shipped prebuilt binaries (no compiler needed)
26
+ UPLINK_INSTALL=prebuilt npm install @shivam995364/uplink-nodejs-test
38
27
 
39
- #### Option 2: Hybrid (recommended)
28
+ # Compile the Node.js addon from C source (uses shipped libuplink)
29
+ UPLINK_INSTALL=hybrid npm install @shivam995364/uplink-nodejs-test
40
30
 
41
- Downloads the prebuilt `libuplink` shared library, then compiles the Node.js native addon locally with `node-gyp`. This is the default method used by `make install`.
31
+ # Build everything from source including libuplink (Go + C)
32
+ UPLINK_INSTALL=source npm install @shivam995364/uplink-nodejs-test
42
33
 
43
- ```bash
44
- npm install @shivam995364/uplink-nodejs-test
45
- cd node_modules/@shivam995364/uplink-nodejs-test
46
- make install-hybrid
34
+ # Skip native build entirely (install JS only, build later)
35
+ UPLINK_INSTALL=skip npm install @shivam995364/uplink-nodejs-test
47
36
  ```
48
37
 
49
- Or via npm script:
50
-
51
- ```bash
52
- npm run install:hybrid
53
- ```
38
+ > **Windows (PowerShell):**
39
+ > ```powershell
40
+ > $env:UPLINK_INSTALL="prebuilt"; npm install @shivam995364/uplink-nodejs-test
41
+ > ```
54
42
 
55
- **Requirements:** C compiler (`gcc`, `clang`, or MSVC), Python 3.x (for node-gyp)
43
+ > **Windows (CMD):**
44
+ > ```cmd
45
+ > set UPLINK_INSTALL=prebuilt && npm install @shivam995364/uplink-nodejs-test
46
+ > ```
56
47
 
57
- #### Option 3: Source (full build)
48
+ ### UPLINK_INSTALL Values
58
49
 
59
- Builds everything from source clones (or uses a local copy of) `uplink-c`, compiles the Go shared library, and then compiles the Node.js addon.
50
+ | Value | What it does | Requirements | Speed |
51
+ |-------|-------------|-------------|-------|
52
+ | *(unset)* | Auto-detect: prebuilt → hybrid → source | Varies | ⚡ → 🛠️ |
53
+ | `prebuilt` | Use binaries shipped in the npm package | Node.js only | ⚡ Instant |
54
+ | `hybrid` | Compile `.node` addon from shipped C source | C compiler | 🔧 ~30s |
55
+ | `source` | Build `libuplink` from Go + compile addon | Go + C compiler + Git | 🛠️ ~2min |
56
+ | `skip` | Skip native build entirely | None | ⚡ Instant |
60
57
 
61
- ```bash
62
- npm install @shivam995364/uplink-nodejs-test
63
- cd node_modules/@shivam995364/uplink-nodejs-test
64
- make install-source
65
- ```
58
+ ### Using Make Directly
66
59
 
67
- Or with a local uplink-c checkout:
60
+ You can also use Make targets directly (equivalent to the env var approach):
68
61
 
69
62
  ```bash
70
- make install-source UPLINK_C_DIR=/path/to/uplink-c
63
+ make install # auto-detect
64
+ UPLINK_INSTALL=prebuilt make install # prebuilt
65
+ UPLINK_INSTALL=hybrid make install # hybrid
66
+ UPLINK_INSTALL=source make install # source
71
67
  ```
72
68
 
73
- Or via npm script:
69
+ Or the dedicated targets:
74
70
 
75
71
  ```bash
76
- npm run install:source
72
+ make install-prebuilt # Download everything (no compiler)
73
+ make install-hybrid # Download lib, compile addon
74
+ make install-source # Build everything from source
77
75
  ```
78
76
 
79
- **Requirements:** Go 1.21+, Git, C compiler, Python 3.x
80
-
81
- #### Auto-detect
82
-
83
- Let the Makefile choose the best available method (tries hybrid first, falls back to source):
77
+ With a local uplink-c checkout:
84
78
 
85
79
  ```bash
86
- make install
80
+ UPLINK_INSTALL=source UPLINK_C_DIR=/path/to/uplink-c npm install @shivam995364/uplink-nodejs-test
81
+ # or
82
+ make install-source UPLINK_C_DIR=/path/to/uplink-c
87
83
  ```
88
84
 
89
85
  ### Verify Installation
@@ -107,6 +103,9 @@ make verify-full
107
103
  You can customise the build with environment variables:
108
104
 
109
105
  ```bash
106
+ # Select installation method
107
+ UPLINK_INSTALL=prebuilt make install
108
+
110
109
  # Use a specific uplink-c version
111
110
  make install-hybrid UPLINK_C_VERSION=v1.13.0
112
111
 
@@ -120,6 +119,15 @@ make download-lib FORCE_DOWNLOAD=1
120
119
  make install-hybrid VERBOSE=1
121
120
  ```
122
121
 
122
+ | Variable | Description | Default |
123
+ |----------|-------------|---------|
124
+ | `UPLINK_INSTALL` | Installation method: `prebuilt`, `hybrid`, `source`, `skip` | auto-detect |
125
+ | `UPLINK_C_DIR` | Path to uplink-c source | `../uplink-c` |
126
+ | `UPLINK_C_VERSION` | uplink-c version to download/clone | `v1.14.0` |
127
+ | `PLATFORM` | Target platform override | auto-detect |
128
+ | `FORCE_DOWNLOAD` | Force re-download (`1` to enable) | `0` |
129
+ | `VERBOSE` | Verbose output (`1` to enable) | `0` |
130
+
123
131
  ### Installing Make on Windows
124
132
 
125
133
  ```powershell
@@ -216,6 +224,7 @@ make test-c
216
224
 
217
225
  | Variable | Description | Default |
218
226
  |----------|-------------|---------|
227
+ | `UPLINK_INSTALL` | Installation method: `prebuilt`, `hybrid`, `source`, `skip`, or auto | auto-detect |
219
228
  | `UPLINK_LOG_LEVEL` | Log level: `none`, `error`, `warn`, `info`, `debug`, `trace` | `info` |
220
229
  | `UPLINK_LOG_FILE` | Path to log file | none (stdout) |
221
230
  | `UPLINK_LIBRARY_PATH` | Custom path to uplink-c library | auto-detect |
@@ -227,9 +236,9 @@ Run `make help` for the full list. Highlights:
227
236
  | Command | Description |
228
237
  |---------|-------------|
229
238
  | `make install` | Auto-detect best installation method |
230
- | `make install-prebuilt` | Download everything (no compiler) |
231
- | `make install-hybrid` | Download lib, build addon locally |
232
- | `make install-source` | Build everything from source |
239
+ | `UPLINK_INSTALL=prebuilt make install` | Use shipped prebuilt binaries |
240
+ | `UPLINK_INSTALL=hybrid make install` | Compile addon only |
241
+ | `UPLINK_INSTALL=source make install` | Full source build |
233
242
  | `make build` | Build TypeScript + native addon |
234
243
  | `make test` | Run all tests |
235
244
  | `make verify-full` | Verify library + addon installed |
@@ -12,6 +12,8 @@
12
12
 
13
13
  #ifndef GO_CGO_GOSTRING_TYPEDEF
14
14
  typedef struct { const char *p; ptrdiff_t n; } _GoString_;
15
+ extern size_t _GoStringLen(_GoString_ s);
16
+ extern const char *_GoStringPtr(_GoString_ s);
15
17
  #endif
16
18
 
17
19
  #endif
@@ -129,10 +131,16 @@ typedef size_t GoUintptr;
129
131
  typedef float GoFloat32;
130
132
  typedef double GoFloat64;
131
133
  #ifdef _MSC_VER
134
+ #if !defined(__cplusplus) || _MSVC_LANG <= 201402L
132
135
  #include <complex.h>
133
136
  typedef _Fcomplex GoComplex64;
134
137
  typedef _Dcomplex GoComplex128;
135
138
  #else
139
+ #include <complex>
140
+ typedef std::complex<float> GoComplex64;
141
+ typedef std::complex<double> GoComplex128;
142
+ #endif
143
+ #else
136
144
  typedef float _Complex GoComplex64;
137
145
  typedef double _Complex GoComplex128;
138
146
  #endif
@@ -155,12 +163,6 @@ typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
155
163
 
156
164
  /* End of boilerplate cgo prologue. */
157
165
 
158
- /* Cross-platform export macro: __declspec(dllexport) is Windows/MSVC only */
159
- #if !defined(_WIN32) && !defined(__CYGWIN__)
160
- #undef __declspec
161
- #define __declspec(x)
162
- #endif
163
-
164
166
  #ifdef __cplusplus
165
167
  extern "C" {
166
168
  #endif
@@ -168,23 +170,23 @@ extern "C" {
168
170
 
169
171
  // uplink_parse_access parses serialized access grant string.
170
172
  //
171
- extern __declspec(dllexport) UplinkAccessResult uplink_parse_access(uplink_const_char* accessString);
173
+ extern UplinkAccessResult uplink_parse_access(uplink_const_char* accessString);
172
174
 
173
175
  // uplink_request_access_with_passphrase requests satellite for a new access grant using a passhprase.
174
176
  //
175
- extern __declspec(dllexport) UplinkAccessResult uplink_request_access_with_passphrase(uplink_const_char* satellite_address, uplink_const_char* api_key, uplink_const_char* passphrase);
177
+ extern UplinkAccessResult uplink_request_access_with_passphrase(uplink_const_char* satellite_address, uplink_const_char* api_key, uplink_const_char* passphrase);
176
178
 
177
179
  // uplink_access_satellite_address returns the satellite node URL for this access grant.
178
180
  //
179
- extern __declspec(dllexport) UplinkStringResult uplink_access_satellite_address(UplinkAccess* access);
181
+ extern UplinkStringResult uplink_access_satellite_address(UplinkAccess* access);
180
182
 
181
183
  // uplink_access_serialize serializes access grant into a string.
182
184
  //
183
- extern __declspec(dllexport) UplinkStringResult uplink_access_serialize(UplinkAccess* access);
185
+ extern UplinkStringResult uplink_access_serialize(UplinkAccess* access);
184
186
 
185
187
  // uplink_access_share creates new access grant with specific permission. Permission will be applied to prefixes when defined.
186
188
  //
187
- extern __declspec(dllexport) UplinkAccessResult uplink_access_share(UplinkAccess* access, UplinkPermission permission, UplinkSharePrefix* prefixes, GoInt prefixes_count);
189
+ extern UplinkAccessResult uplink_access_share(UplinkAccess* access, UplinkPermission permission, UplinkSharePrefix* prefixes, GoInt prefixes_count);
188
190
 
189
191
  // uplink_access_override_encryption_key overrides the root encryption key for the prefix in
190
192
  // bucket with encryptionKey.
@@ -192,118 +194,118 @@ extern __declspec(dllexport) UplinkAccessResult uplink_access_share(UplinkAccess
192
194
  // This function is useful for overriding the encryption key in user-specific
193
195
  // access grants when implementing multitenancy in a single app bucket.
194
196
  //
195
- extern __declspec(dllexport) UplinkError* uplink_access_override_encryption_key(UplinkAccess* access, uplink_const_char* bucket, uplink_const_char* prefix, UplinkEncryptionKey* encryptionKey);
197
+ extern UplinkError* uplink_access_override_encryption_key(UplinkAccess* access, uplink_const_char* bucket, uplink_const_char* prefix, UplinkEncryptionKey* encryptionKey);
196
198
 
197
199
  // uplink_free_string_result frees the resources associated with string result.
198
200
  //
199
- extern __declspec(dllexport) void uplink_free_string_result(UplinkStringResult result);
201
+ extern void uplink_free_string_result(UplinkStringResult result);
200
202
 
201
203
  // uplink_free_access_result frees the resources associated with access grant.
202
204
  //
203
- extern __declspec(dllexport) void uplink_free_access_result(UplinkAccessResult result);
205
+ extern void uplink_free_access_result(UplinkAccessResult result);
204
206
 
205
207
  // uplink_stat_bucket returns information about a bucket.
206
208
  //
207
- extern __declspec(dllexport) UplinkBucketResult uplink_stat_bucket(UplinkProject* project, uplink_const_char* bucket_name);
209
+ extern UplinkBucketResult uplink_stat_bucket(UplinkProject* project, uplink_const_char* bucket_name);
208
210
 
209
211
  // uplink_create_bucket creates a new bucket.
210
212
  //
211
213
  // When bucket already exists it returns a valid Bucket and ErrBucketExists.
212
214
  //
213
- extern __declspec(dllexport) UplinkBucketResult uplink_create_bucket(UplinkProject* project, uplink_const_char* bucket_name);
215
+ extern UplinkBucketResult uplink_create_bucket(UplinkProject* project, uplink_const_char* bucket_name);
214
216
 
215
217
  // uplink_ensure_bucket creates a new bucket and ignores the error when it already exists.
216
218
  //
217
219
  // When bucket already exists it returns a valid Bucket and ErrBucketExists.
218
220
  //
219
- extern __declspec(dllexport) UplinkBucketResult uplink_ensure_bucket(UplinkProject* project, uplink_const_char* bucket_name);
221
+ extern UplinkBucketResult uplink_ensure_bucket(UplinkProject* project, uplink_const_char* bucket_name);
220
222
 
221
223
  // uplink_delete_bucket deletes a bucket.
222
224
  //
223
225
  // When bucket is not empty it returns ErrBucketNotEmpty.
224
226
  //
225
- extern __declspec(dllexport) UplinkBucketResult uplink_delete_bucket(UplinkProject* project, uplink_const_char* bucket_name);
227
+ extern UplinkBucketResult uplink_delete_bucket(UplinkProject* project, uplink_const_char* bucket_name);
226
228
 
227
229
  // uplink_delete_bucket_with_objects deletes a bucket and all objects within that bucket.
228
230
  //
229
231
  // When there are concurrent writes to the bucket it returns ErrBucketNotEmpty.
230
232
  //
231
- extern __declspec(dllexport) UplinkBucketResult uplink_delete_bucket_with_objects(UplinkProject* project, uplink_const_char* bucket_name);
233
+ extern UplinkBucketResult uplink_delete_bucket_with_objects(UplinkProject* project, uplink_const_char* bucket_name);
232
234
 
233
235
  // uplink_free_bucket_result frees memory associated with the BucketResult.
234
236
  //
235
- extern __declspec(dllexport) void uplink_free_bucket_result(UplinkBucketResult result);
237
+ extern void uplink_free_bucket_result(UplinkBucketResult result);
236
238
 
237
239
  // uplink_free_bucket frees memory associated with the bucket.
238
240
  //
239
- extern __declspec(dllexport) void uplink_free_bucket(UplinkBucket* bucket);
241
+ extern void uplink_free_bucket(UplinkBucket* bucket);
240
242
 
241
243
  // uplink_list_buckets lists buckets.
242
244
  //
243
- extern __declspec(dllexport) UplinkBucketIterator* uplink_list_buckets(UplinkProject* project, UplinkListBucketsOptions* options);
245
+ extern UplinkBucketIterator* uplink_list_buckets(UplinkProject* project, UplinkListBucketsOptions* options);
244
246
 
245
247
  // uplink_bucket_iterator_next prepares next Bucket for reading.
246
248
  //
247
249
  // It returns false if the end of the iteration is reached and there are no more buckets, or if there is an error.
248
250
  //
249
- extern __declspec(dllexport) _Bool uplink_bucket_iterator_next(UplinkBucketIterator* iterator);
251
+ extern _Bool uplink_bucket_iterator_next(UplinkBucketIterator* iterator);
250
252
 
251
253
  // uplink_bucket_iterator_err returns error, if one happened during iteration.
252
254
  //
253
- extern __declspec(dllexport) UplinkError* uplink_bucket_iterator_err(UplinkBucketIterator* iterator);
255
+ extern UplinkError* uplink_bucket_iterator_err(UplinkBucketIterator* iterator);
254
256
 
255
257
  // uplink_bucket_iterator_item returns the current bucket in the iterator.
256
258
  //
257
- extern __declspec(dllexport) UplinkBucket* uplink_bucket_iterator_item(UplinkBucketIterator* iterator);
259
+ extern UplinkBucket* uplink_bucket_iterator_item(UplinkBucketIterator* iterator);
258
260
 
259
261
  // uplink_free_bucket_iterator frees memory associated with the BucketIterator.
260
262
  //
261
- extern __declspec(dllexport) void uplink_free_bucket_iterator(UplinkBucketIterator* iterator);
263
+ extern void uplink_free_bucket_iterator(UplinkBucketIterator* iterator);
262
264
 
263
265
  // uplink_config_request_access_with_passphrase requests satellite for a new access grant using a passhprase.
264
266
  //
265
- extern __declspec(dllexport) UplinkAccessResult uplink_config_request_access_with_passphrase(UplinkConfig config, uplink_const_char* satellite_address, uplink_const_char* api_key, uplink_const_char* passphrase);
267
+ extern UplinkAccessResult uplink_config_request_access_with_passphrase(UplinkConfig config, uplink_const_char* satellite_address, uplink_const_char* api_key, uplink_const_char* passphrase);
266
268
 
267
269
  // uplink_config_open_project opens project using access grant.
268
270
  //
269
- extern __declspec(dllexport) UplinkProjectResult uplink_config_open_project(UplinkConfig config, UplinkAccess* access);
271
+ extern UplinkProjectResult uplink_config_open_project(UplinkConfig config, UplinkAccess* access);
270
272
 
271
273
  // uplink_copy_object copies object to a same/different bucket and key.
272
274
  //
273
- extern __declspec(dllexport) UplinkObjectResult uplink_copy_object(UplinkProject* project, uplink_const_char* old_bucket_name, uplink_const_char* old_object_key, uplink_const_char* new_bucket_name, uplink_const_char* new_object_key, UplinkCopyObjectOptions* options);
275
+ extern UplinkObjectResult uplink_copy_object(UplinkProject* project, uplink_const_char* old_bucket_name, uplink_const_char* old_object_key, uplink_const_char* new_bucket_name, uplink_const_char* new_object_key, UplinkCopyObjectOptions* options);
274
276
 
275
277
  // uplink_download_object starts download to the specified key.
276
278
  //
277
- extern __declspec(dllexport) UplinkDownloadResult uplink_download_object(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key, UplinkDownloadOptions* options);
279
+ extern UplinkDownloadResult uplink_download_object(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key, UplinkDownloadOptions* options);
278
280
 
279
281
  // uplink_download_read downloads from object's data stream into bytes up to length amount.
280
282
  // It returns the number of bytes read (0 <= bytes_read <= length) and
281
283
  // any error encountered that caused the read to stop early.
282
284
  //
283
- extern __declspec(dllexport) UplinkReadResult uplink_download_read(UplinkDownload* download, void* bytes, size_t length);
285
+ extern UplinkReadResult uplink_download_read(UplinkDownload* download, void* bytes, size_t length);
284
286
 
285
287
  // uplink_download_info returns information about the downloaded object.
286
288
  //
287
- extern __declspec(dllexport) UplinkObjectResult uplink_download_info(UplinkDownload* download);
289
+ extern UplinkObjectResult uplink_download_info(UplinkDownload* download);
288
290
 
289
291
  // uplink_free_read_result frees any resources associated with read result.
290
292
  //
291
- extern __declspec(dllexport) void uplink_free_read_result(UplinkReadResult result);
293
+ extern void uplink_free_read_result(UplinkReadResult result);
292
294
 
293
295
  // uplink_close_download closes the download.
294
296
  //
295
- extern __declspec(dllexport) UplinkError* uplink_close_download(UplinkDownload* download);
297
+ extern UplinkError* uplink_close_download(UplinkDownload* download);
296
298
 
297
299
  // uplink_free_download_result frees any associated resources.
298
300
  //
299
- extern __declspec(dllexport) void uplink_free_download_result(UplinkDownloadResult result);
301
+ extern void uplink_free_download_result(UplinkDownloadResult result);
300
302
 
301
303
  // edge_register_access gets credentials for the Storj-hosted Gateway-mt and linkshare service.
302
304
  // All files uploaded under the Access are then accessible via those services.
303
305
  //
304
- extern __declspec(dllexport) EdgeCredentialsResult edge_register_access(EdgeConfig config, UplinkAccess* access, EdgeRegisterAccessOptions* options);
305
- extern __declspec(dllexport) void edge_free_credentials_result(EdgeCredentialsResult result);
306
- extern __declspec(dllexport) void edge_free_credentials(EdgeCredentials* credentials);
306
+ extern EdgeCredentialsResult edge_register_access(EdgeConfig config, UplinkAccess* access, EdgeRegisterAccessOptions* options);
307
+ extern void edge_free_credentials_result(EdgeCredentialsResult result);
308
+ extern void edge_free_credentials(EdgeCredentials* credentials);
307
309
 
308
310
  // edge_join_share_url concats a linkshare URL
309
311
  // Example result: https://link.us1.storjshare.io/s/l5pucy3dmvzxgs3fpfewix27l5pq/mybucket/myprefix/myobject
@@ -315,7 +317,7 @@ extern __declspec(dllexport) void edge_free_credentials(EdgeCredentials* credent
315
317
  // bucket: optional bucket, if empty shares the entire project.
316
318
  // key: optional object key or prefix, if empty shares the entire bucket. A prefix must end with "/".
317
319
  //
318
- extern __declspec(dllexport) UplinkStringResult edge_join_share_url(uplink_const_char* baseURL, uplink_const_char* accessKeyID, uplink_const_char* bucket, uplink_const_char* key, EdgeShareURLOptions* options);
320
+ extern UplinkStringResult edge_join_share_url(uplink_const_char* baseURL, uplink_const_char* accessKeyID, uplink_const_char* bucket, uplink_const_char* key, EdgeShareURLOptions* options);
319
321
 
320
322
  // uplink_derive_encryption_key derives a salted encryption key for passphrase using the
321
323
  // salt.
@@ -323,222 +325,222 @@ extern __declspec(dllexport) UplinkStringResult edge_join_share_url(uplink_const
323
325
  // This function is useful for deriving a salted encryption key for users when
324
326
  // implementing multitenancy in a single app bucket.
325
327
  //
326
- extern __declspec(dllexport) UplinkEncryptionKeyResult uplink_derive_encryption_key(uplink_const_char* passphrase, void* salt, size_t length);
328
+ extern UplinkEncryptionKeyResult uplink_derive_encryption_key(uplink_const_char* passphrase, void* salt, size_t length);
327
329
 
328
330
  // uplink_free_encryption_key_result frees the resources associated with encryption key.
329
331
  //
330
- extern __declspec(dllexport) void uplink_free_encryption_key_result(UplinkEncryptionKeyResult result);
332
+ extern void uplink_free_encryption_key_result(UplinkEncryptionKeyResult result);
331
333
 
332
334
  // uplink_free_error frees error data.
333
335
  //
334
- extern __declspec(dllexport) void uplink_free_error(UplinkError* err);
336
+ extern void uplink_free_error(UplinkError* err);
335
337
 
336
338
  // uplink_internal_UniverseIsEmpty returns true if nothing is stored in the global map.
337
339
  //
338
- extern __declspec(dllexport) GoUint8 uplink_internal_UniverseIsEmpty();
340
+ extern GoUint8 uplink_internal_UniverseIsEmpty(void);
339
341
 
340
342
  // uplink_move_object moves object to a different bucket or/and key.
341
343
  //
342
- extern __declspec(dllexport) UplinkError* uplink_move_object(UplinkProject* project, uplink_const_char* old_bucket_name, uplink_const_char* old_object_key, uplink_const_char* new_bucket_name, uplink_const_char* new_object_key, UplinkMoveObjectOptions* options);
344
+ extern UplinkError* uplink_move_object(UplinkProject* project, uplink_const_char* old_bucket_name, uplink_const_char* old_object_key, uplink_const_char* new_bucket_name, uplink_const_char* new_object_key, UplinkMoveObjectOptions* options);
343
345
 
344
346
  // uplink_begin_upload begins a new multipart upload to bucket and key.
345
347
  //
346
- extern __declspec(dllexport) UplinkUploadInfoResult uplink_begin_upload(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key, UplinkUploadOptions* options);
348
+ extern UplinkUploadInfoResult uplink_begin_upload(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key, UplinkUploadOptions* options);
347
349
 
348
350
  // uplink_free_upload_info_result frees any resources associated with upload info result.
349
351
  //
350
- extern __declspec(dllexport) void uplink_free_upload_info_result(UplinkUploadInfoResult result);
352
+ extern void uplink_free_upload_info_result(UplinkUploadInfoResult result);
351
353
 
352
354
  // uplink_free_upload_info frees memory associated with upload info.
353
355
  //
354
- extern __declspec(dllexport) void uplink_free_upload_info(UplinkUploadInfo* info);
356
+ extern void uplink_free_upload_info(UplinkUploadInfo* info);
355
357
 
356
358
  // uplink_commit_upload commits a multipart upload to bucket and key started with uplink_begin_upload.
357
359
  //
358
- extern __declspec(dllexport) UplinkCommitUploadResult uplink_commit_upload(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key, uplink_const_char* upload_id, UplinkCommitUploadOptions* options);
360
+ extern UplinkCommitUploadResult uplink_commit_upload(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key, uplink_const_char* upload_id, UplinkCommitUploadOptions* options);
359
361
 
360
362
  // uplink_free_commit_upload_result frees any resources associated with commit upload result.
361
363
  //
362
- extern __declspec(dllexport) void uplink_free_commit_upload_result(UplinkCommitUploadResult result);
364
+ extern void uplink_free_commit_upload_result(UplinkCommitUploadResult result);
363
365
 
364
366
  // uplink_abort_upload aborts a multipart upload started with uplink_begin_upload.
365
367
  //
366
- extern __declspec(dllexport) UplinkError* uplink_abort_upload(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key, uplink_const_char* upload_id);
368
+ extern UplinkError* uplink_abort_upload(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key, uplink_const_char* upload_id);
367
369
 
368
370
  // uplink_upload_part starts an part upload to the specified key nad part number.
369
371
  //
370
- extern __declspec(dllexport) UplinkPartUploadResult uplink_upload_part(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key, uplink_const_char* upload_id, uint32_t part_number);
372
+ extern UplinkPartUploadResult uplink_upload_part(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key, uplink_const_char* upload_id, uint32_t part_number);
371
373
 
372
374
  // uplink_part_upload_write uploads len(p) bytes from p to the object's data stream.
373
375
  // It returns the number of bytes written from p (0 <= n <= len(p)) and
374
376
  // any error encountered that caused the write to stop early.
375
377
  //
376
- extern __declspec(dllexport) UplinkWriteResult uplink_part_upload_write(UplinkPartUpload* upload, void* bytes, size_t length);
378
+ extern UplinkWriteResult uplink_part_upload_write(UplinkPartUpload* upload, void* bytes, size_t length);
377
379
 
378
380
  // uplink_part_upload_commit commits the uploaded part data.
379
381
  //
380
- extern __declspec(dllexport) UplinkError* uplink_part_upload_commit(UplinkPartUpload* upload);
382
+ extern UplinkError* uplink_part_upload_commit(UplinkPartUpload* upload);
381
383
 
382
384
  // uplink_part_upload_abort aborts a part upload.
383
385
  //
384
- extern __declspec(dllexport) UplinkError* uplink_part_upload_abort(UplinkPartUpload* upload);
386
+ extern UplinkError* uplink_part_upload_abort(UplinkPartUpload* upload);
385
387
 
386
388
  // uplink_part_upload_set_etag sets part ETag.
387
389
  //
388
- extern __declspec(dllexport) UplinkError* uplink_part_upload_set_etag(UplinkPartUpload* upload, uplink_const_char* etag);
390
+ extern UplinkError* uplink_part_upload_set_etag(UplinkPartUpload* upload, uplink_const_char* etag);
389
391
 
390
392
  // uplink_part_upload_info returns the last information about the uploaded part.
391
393
  //
392
- extern __declspec(dllexport) UplinkPartResult uplink_part_upload_info(UplinkPartUpload* upload);
394
+ extern UplinkPartResult uplink_part_upload_info(UplinkPartUpload* upload);
393
395
 
394
396
  // uplink_free_part_result frees memory associated with the part result.
395
397
  //
396
- extern __declspec(dllexport) void uplink_free_part_result(UplinkPartResult result);
398
+ extern void uplink_free_part_result(UplinkPartResult result);
397
399
 
398
400
  // uplink_free_part_upload_result frees memory associated with the part upload result.
399
401
  //
400
- extern __declspec(dllexport) void uplink_free_part_upload_result(UplinkPartUploadResult result);
402
+ extern void uplink_free_part_upload_result(UplinkPartUploadResult result);
401
403
 
402
404
  // uplink_free_part frees memory associated with the Part.
403
405
  //
404
- extern __declspec(dllexport) void uplink_free_part(UplinkPart* part);
406
+ extern void uplink_free_part(UplinkPart* part);
405
407
 
406
408
  // uplink_list_uploads lists uploads.
407
409
  //
408
- extern __declspec(dllexport) UplinkUploadIterator* uplink_list_uploads(UplinkProject* project, uplink_const_char* bucket_name, UplinkListUploadsOptions* options);
410
+ extern UplinkUploadIterator* uplink_list_uploads(UplinkProject* project, uplink_const_char* bucket_name, UplinkListUploadsOptions* options);
409
411
 
410
412
  // uplink_upload_iterator_next prepares next entry for reading.
411
413
  //
412
414
  // It returns false if the end of the iteration is reached and there are no more uploads, or if there is an error.
413
415
  //
414
- extern __declspec(dllexport) _Bool uplink_upload_iterator_next(UplinkUploadIterator* iterator);
416
+ extern _Bool uplink_upload_iterator_next(UplinkUploadIterator* iterator);
415
417
 
416
418
  // uplink_upload_iterator_err returns error, if one happened during iteration.
417
419
  //
418
- extern __declspec(dllexport) UplinkError* uplink_upload_iterator_err(UplinkUploadIterator* iterator);
420
+ extern UplinkError* uplink_upload_iterator_err(UplinkUploadIterator* iterator);
419
421
 
420
422
  // uplink_upload_iterator_item returns the current entry in the iterator.
421
423
  //
422
- extern __declspec(dllexport) UplinkUploadInfo* uplink_upload_iterator_item(UplinkUploadIterator* iterator);
424
+ extern UplinkUploadInfo* uplink_upload_iterator_item(UplinkUploadIterator* iterator);
423
425
 
424
426
  // uplink_free_upload_iterator frees memory associated with the UploadIterator.
425
427
  //
426
- extern __declspec(dllexport) void uplink_free_upload_iterator(UplinkUploadIterator* iterator);
428
+ extern void uplink_free_upload_iterator(UplinkUploadIterator* iterator);
427
429
 
428
430
  // uplink_list_upload_parts lists uploaded parts.
429
431
  //
430
- extern __declspec(dllexport) UplinkPartIterator* uplink_list_upload_parts(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key, uplink_const_char* upload_id, UplinkListUploadPartsOptions* options);
432
+ extern UplinkPartIterator* uplink_list_upload_parts(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key, uplink_const_char* upload_id, UplinkListUploadPartsOptions* options);
431
433
 
432
434
  // uplink_part_iterator_next prepares next entry for reading.
433
435
  //
434
436
  // It returns false if the end of the iteration is reached and there are no more parts, or if there is an error.
435
437
  //
436
- extern __declspec(dllexport) _Bool uplink_part_iterator_next(UplinkPartIterator* iterator);
438
+ extern _Bool uplink_part_iterator_next(UplinkPartIterator* iterator);
437
439
 
438
440
  // uplink_part_iterator_err returns error, if one happened during iteration.
439
441
  //
440
- extern __declspec(dllexport) UplinkError* uplink_part_iterator_err(UplinkPartIterator* iterator);
442
+ extern UplinkError* uplink_part_iterator_err(UplinkPartIterator* iterator);
441
443
 
442
444
  // uplink_part_iterator_item returns the current entry in the iterator.
443
445
  //
444
- extern __declspec(dllexport) UplinkPart* uplink_part_iterator_item(UplinkPartIterator* iterator);
446
+ extern UplinkPart* uplink_part_iterator_item(UplinkPartIterator* iterator);
445
447
 
446
448
  // uplink_free_part_iterator frees memory associated with the UplinkPartIterator.
447
449
  //
448
- extern __declspec(dllexport) void uplink_free_part_iterator(UplinkPartIterator* iterator);
450
+ extern void uplink_free_part_iterator(UplinkPartIterator* iterator);
449
451
 
450
452
  // uplink_stat_object returns information about an object at the specific key.
451
453
  //
452
- extern __declspec(dllexport) UplinkObjectResult uplink_stat_object(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key);
454
+ extern UplinkObjectResult uplink_stat_object(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key);
453
455
 
454
456
  // uplink_delete_object deletes an object.
455
457
  //
456
- extern __declspec(dllexport) UplinkObjectResult uplink_delete_object(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key);
458
+ extern UplinkObjectResult uplink_delete_object(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key);
457
459
 
458
460
  // uplink_free_object_result frees memory associated with the ObjectResult.
459
461
  //
460
- extern __declspec(dllexport) void uplink_free_object_result(UplinkObjectResult obj);
462
+ extern void uplink_free_object_result(UplinkObjectResult obj);
461
463
 
462
464
  // uplink_free_object frees memory associated with the Object.
463
465
  //
464
- extern __declspec(dllexport) void uplink_free_object(UplinkObject* obj);
466
+ extern void uplink_free_object(UplinkObject* obj);
465
467
 
466
468
  // uplink_update_object_metadata replaces the custom metadata for the object at the specific key with new_metadata.
467
469
  // Any existing custom metadata will be deleted.
468
470
  //
469
- extern __declspec(dllexport) UplinkError* uplink_update_object_metadata(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key, UplinkCustomMetadata new_metadata, UplinkUploadObjectMetadataOptions* options);
471
+ extern UplinkError* uplink_update_object_metadata(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key, UplinkCustomMetadata new_metadata, UplinkUploadObjectMetadataOptions* options);
470
472
 
471
473
  // uplink_list_objects lists objects.
472
474
  //
473
- extern __declspec(dllexport) UplinkObjectIterator* uplink_list_objects(UplinkProject* project, uplink_const_char* bucket_name, UplinkListObjectsOptions* options);
475
+ extern UplinkObjectIterator* uplink_list_objects(UplinkProject* project, uplink_const_char* bucket_name, UplinkListObjectsOptions* options);
474
476
 
475
477
  // uplink_object_iterator_next prepares next Object for reading.
476
478
  //
477
479
  // It returns false if the end of the iteration is reached and there are no more objects, or if there is an error.
478
480
  //
479
- extern __declspec(dllexport) _Bool uplink_object_iterator_next(UplinkObjectIterator* iterator);
481
+ extern _Bool uplink_object_iterator_next(UplinkObjectIterator* iterator);
480
482
 
481
483
  // uplink_object_iterator_err returns error, if one happened during iteration.
482
484
  //
483
- extern __declspec(dllexport) UplinkError* uplink_object_iterator_err(UplinkObjectIterator* iterator);
485
+ extern UplinkError* uplink_object_iterator_err(UplinkObjectIterator* iterator);
484
486
 
485
487
  // uplink_object_iterator_item returns the current object in the iterator.
486
488
  //
487
- extern __declspec(dllexport) UplinkObject* uplink_object_iterator_item(UplinkObjectIterator* iterator);
489
+ extern UplinkObject* uplink_object_iterator_item(UplinkObjectIterator* iterator);
488
490
 
489
491
  // uplink_free_object_iterator frees memory associated with the ObjectIterator.
490
492
  //
491
- extern __declspec(dllexport) void uplink_free_object_iterator(UplinkObjectIterator* iterator);
493
+ extern void uplink_free_object_iterator(UplinkObjectIterator* iterator);
492
494
 
493
495
  // uplink_open_project opens project using access grant.
494
496
  //
495
- extern __declspec(dllexport) UplinkProjectResult uplink_open_project(UplinkAccess* access);
497
+ extern UplinkProjectResult uplink_open_project(UplinkAccess* access);
496
498
 
497
499
  // uplink_close_project closes the project.
498
500
  //
499
- extern __declspec(dllexport) UplinkError* uplink_close_project(UplinkProject* project);
501
+ extern UplinkError* uplink_close_project(UplinkProject* project);
500
502
 
501
503
  // uplink_revoke_access revokes the API key embedded in the provided access grant.
502
504
  //
503
- extern __declspec(dllexport) UplinkError* uplink_revoke_access(UplinkProject* project, UplinkAccess* access);
505
+ extern UplinkError* uplink_revoke_access(UplinkProject* project, UplinkAccess* access);
504
506
 
505
507
  // uplink_free_project_result frees any associated resources.
506
508
  //
507
- extern __declspec(dllexport) void uplink_free_project_result(UplinkProjectResult result);
509
+ extern void uplink_free_project_result(UplinkProjectResult result);
508
510
 
509
511
  // uplink_upload_object starts an upload to the specified key.
510
512
  //
511
- extern __declspec(dllexport) UplinkUploadResult uplink_upload_object(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key, UplinkUploadOptions* options);
513
+ extern UplinkUploadResult uplink_upload_object(UplinkProject* project, uplink_const_char* bucket_name, uplink_const_char* object_key, UplinkUploadOptions* options);
512
514
 
513
515
  // uplink_upload_write uploads len(p) bytes from p to the object's data stream.
514
516
  // It returns the number of bytes written from p (0 <= n <= len(p)) and
515
517
  // any error encountered that caused the write to stop early.
516
518
  //
517
- extern __declspec(dllexport) UplinkWriteResult uplink_upload_write(UplinkUpload* upload, void* bytes, size_t length);
519
+ extern UplinkWriteResult uplink_upload_write(UplinkUpload* upload, void* bytes, size_t length);
518
520
 
519
521
  // uplink_upload_commit commits the uploaded data.
520
522
  //
521
- extern __declspec(dllexport) UplinkError* uplink_upload_commit(UplinkUpload* upload);
523
+ extern UplinkError* uplink_upload_commit(UplinkUpload* upload);
522
524
 
523
525
  // uplink_upload_abort aborts an upload.
524
526
  //
525
- extern __declspec(dllexport) UplinkError* uplink_upload_abort(UplinkUpload* upload);
527
+ extern UplinkError* uplink_upload_abort(UplinkUpload* upload);
526
528
 
527
529
  // uplink_upload_info returns the last information about the uploaded object.
528
530
  //
529
- extern __declspec(dllexport) UplinkObjectResult uplink_upload_info(UplinkUpload* upload);
531
+ extern UplinkObjectResult uplink_upload_info(UplinkUpload* upload);
530
532
 
531
533
  // uplink_upload_set_custom_metadata returns the last information about the uploaded object.
532
534
  //
533
- extern __declspec(dllexport) UplinkError* uplink_upload_set_custom_metadata(UplinkUpload* upload, UplinkCustomMetadata custom);
535
+ extern UplinkError* uplink_upload_set_custom_metadata(UplinkUpload* upload, UplinkCustomMetadata custom);
534
536
 
535
537
  // uplink_free_write_result frees any resources associated with write result.
536
538
  //
537
- extern __declspec(dllexport) void uplink_free_write_result(UplinkWriteResult result);
539
+ extern void uplink_free_write_result(UplinkWriteResult result);
538
540
 
539
541
  // uplink_free_upload_result closes the upload and frees any associated resources.
540
542
  //
541
- extern __declspec(dllexport) void uplink_free_upload_result(UplinkUploadResult result);
543
+ extern void uplink_free_upload_result(UplinkUploadResult result);
542
544
 
543
545
  #ifdef __cplusplus
544
546
  }
@@ -321,7 +321,6 @@ typedef struct UplinkUploadObjectMetadataOptions { char _reserved; } UplinkUploa
321
321
  typedef struct UplinkCopyObjectOptions { char _reserved; } UplinkCopyObjectOptions;
322
322
 
323
323
  #else /* GCC / Clang */
324
-
325
324
  // we need to suppress 'pedantic' validation because struct is empty for now
326
325
  #pragma GCC diagnostic push
327
326
  #pragma GCC diagnostic ignored "-Wpedantic"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shivam995364/uplink-nodejs-test",
3
- "version": "0.1.0-beta.6",
3
+ "version": "0.1.0-beta.7",
4
4
  "description": "Node.js bindings for Storj's uplink-c library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "test:integration": "jest test/integration --testTimeout=60000",
25
25
  "test:memory": "UPLINK_LOG_LEVEL=error node --expose-gc node_modules/.bin/jest test/memory --testTimeout=1800000 --runInBand",
26
26
  "test:e2e": "jest test/e2e --testTimeout=120000",
27
- "test:install": "jest test/install --testTimeout=600000 --runInBand",
27
+ "test:install": "jest --config jest.config.install.js --runInBand",
28
28
  "test:c": "npm run test:c:helpers && npm run test:c:string && npm run test:c:handle",
29
29
  "test:c:helpers": "cc -std=c11 -Wall -Wextra -I native/test native/test/test_helpers.c -o native/test/test_helpers && ./native/test/test_helpers",
30
30
  "test:c:string": "cc -std=c11 -Wall -Wextra -I native/test native/test/test_string_helpers.c -o native/test/test_string_helpers && ./native/test/test_string_helpers",
@@ -45,7 +45,7 @@
45
45
  "security:licenses": "npx license-checker --production --onlyAllow 'MIT;Apache-2.0;BSD-2-Clause;BSD-3-Clause;ISC;0BSD'",
46
46
  "security:all": "npm run security && npm run security:c && npm run security:secrets && npm run security:licenses",
47
47
  "prepublishOnly": "npm run lint && npm run build && npm run test:unit",
48
- "postinstall": "make install 2>/dev/null || node scripts/postinstall-fallback.js",
48
+ "postinstall": "make install || node scripts/postinstall-fallback.js",
49
49
  "install:source": "UPLINK_INSTALL=source make install",
50
50
  "install:hybrid": "UPLINK_INSTALL=hybrid make install",
51
51
  "install:prebuilt": "UPLINK_INSTALL=prebuilt make install",
@@ -20,16 +20,59 @@ const platform = `${process.platform}-${process.arch}`;
20
20
  const prebuildDir = path.join(projectDir, 'native', 'prebuilds', platform);
21
21
  const addonName = 'uplink_native.node';
22
22
 
23
+ // ─── .uplinkrc persistence ──────────────────────────────────────────────────
24
+ // Read/write saved install method so it survives rm -rf node_modules.
25
+ // INIT_CWD is set by npm/yarn/pnpm to the directory where the user ran install.
26
+ const RC_FILENAME = '.uplinkrc';
27
+ const rcDir = process.env.INIT_CWD || path.resolve(projectDir, '..', '..');
28
+ const rcPath = path.join(rcDir, RC_FILENAME);
29
+ const VALID_METHODS = ['prebuilt', 'hybrid', 'source', 'skip'];
30
+
31
+ function readRc() {
32
+ try {
33
+ const val = fs.readFileSync(rcPath, 'utf8').trim();
34
+ return VALID_METHODS.includes(val) ? val : null;
35
+ } catch { return null; }
36
+ }
37
+
38
+ function writeRc(method) {
39
+ if (!VALID_METHODS.includes(method)) return;
40
+ try {
41
+ fs.writeFileSync(rcPath, method + '\n', 'utf8');
42
+ console.log(`[uplink-nodejs] ✔ Saved install method "${method}" to ${rcPath}`);
43
+ } catch { /* non-critical */ }
44
+ }
45
+
46
+ // Resolve UPLINK_INSTALL: env var > .uplinkrc > (none = auto)
47
+ let uplinkInstall = (process.env.UPLINK_INSTALL || '').trim().toLowerCase();
48
+ const fromEnv = !!uplinkInstall;
49
+ if (!uplinkInstall) {
50
+ const saved = readRc();
51
+ if (saved) {
52
+ uplinkInstall = saved;
53
+ console.log(`[uplink-nodejs] Using saved install method "${saved}" from ${rcPath}`);
54
+ }
55
+ }
56
+
23
57
  console.log('[uplink-nodejs] Fallback installer (Make not available)');
24
58
  console.log(` Platform: ${platform}`);
59
+ console.log(` Method: ${uplinkInstall || 'auto'}`);
25
60
  console.log(` Output: ${prebuildDir}`);
26
61
  console.log('');
27
62
 
63
+ // Handle skip method
64
+ if (uplinkInstall === 'skip') {
65
+ console.log('[uplink-nodejs] Method: skip — skipping native build');
66
+ if (fromEnv) writeRc('skip');
67
+ process.exit(0);
68
+ }
69
+
28
70
  // Step 1: Check if prebuilt addon already exists (shipped with npm package or already built)
29
71
  const prebuiltAddon = path.join(prebuildDir, addonName);
30
72
  if (fs.existsSync(prebuiltAddon)) {
31
73
  console.log(`✓ Prebuilt addon found at ${prebuiltAddon}`);
32
74
  console.log(' Skipping build — ready to use.');
75
+ if (fromEnv) writeRc(uplinkInstall);
33
76
  process.exit(0);
34
77
  }
35
78