@spooled/sdk 1.0.37 → 1.0.39

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.
@@ -107,11 +107,11 @@ declare const DEFAULT_CONFIG: {
107
107
  successThreshold: number;
108
108
  timeout: number;
109
109
  };
110
- readonly userAgent: "@spooled/sdk-nodejs/1.0.37";
110
+ readonly userAgent: "@spooled/sdk-nodejs/1.0.39";
111
111
  readonly autoRefreshToken: true;
112
112
  };
113
113
  /** SDK version */
114
- declare const SDK_VERSION = "1.0.37";
114
+ declare const SDK_VERSION = "1.0.39";
115
115
  /** API version prefix */
116
116
  declare const API_VERSION = "v1";
117
117
  /**
@@ -107,11 +107,11 @@ declare const DEFAULT_CONFIG: {
107
107
  successThreshold: number;
108
108
  timeout: number;
109
109
  };
110
- readonly userAgent: "@spooled/sdk-nodejs/1.0.37";
110
+ readonly userAgent: "@spooled/sdk-nodejs/1.0.39";
111
111
  readonly autoRefreshToken: true;
112
112
  };
113
113
  /** SDK version */
114
- declare const SDK_VERSION = "1.0.37";
114
+ declare const SDK_VERSION = "1.0.39";
115
115
  /** API version prefix */
116
116
  declare const API_VERSION = "v1";
117
117
  /**
package/dist/index.cjs CHANGED
@@ -4,6 +4,7 @@ var crypto = require('crypto');
4
4
  var buffer = require('buffer');
5
5
  var grpc2 = require('@grpc/grpc-js');
6
6
  var protoLoader = require('@grpc/proto-loader');
7
+ var fs = require('fs');
7
8
  var url = require('url');
8
9
  var path = require('path');
9
10
  var os = require('os');
@@ -49,10 +50,10 @@ var DEFAULT_CONFIG = {
49
50
  successThreshold: 3,
50
51
  timeout: 3e4
51
52
  },
52
- userAgent: "@spooled/sdk-nodejs/1.0.37",
53
+ userAgent: "@spooled/sdk-nodejs/1.0.39",
53
54
  autoRefreshToken: true
54
55
  };
55
- var SDK_VERSION = "1.0.37";
56
+ var SDK_VERSION = "1.0.39";
56
57
  var API_VERSION = "v1";
57
58
  var API_BASE_PATH = `/api/${API_VERSION}`;
58
59
  function normalizeCredential(value) {
@@ -2559,13 +2560,30 @@ var PROTO_LOADER_OPTIONS = {
2559
2560
  // Support oneofs
2560
2561
  };
2561
2562
  var cachedDefinition = null;
2562
- function getProtoPath() {
2563
+ function getModuleDir() {
2563
2564
  if (typeof (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)) !== "undefined") {
2564
- const __filename = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
2565
- const __dirname2 = path.dirname(__filename);
2566
- return path.join(__dirname2, "../../proto/spooled.proto");
2565
+ return path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
2567
2566
  }
2568
- return path.join(__dirname, "../../proto/spooled.proto");
2567
+ return __dirname;
2568
+ }
2569
+ function getProtoPath() {
2570
+ const moduleDir = getModuleDir();
2571
+ const candidates = [
2572
+ // Bundled ESM/CJS: dist/index.js → ../proto/spooled.proto
2573
+ path.join(moduleDir, "../proto/spooled.proto"),
2574
+ // Source / unbundled: src/grpc/loader.ts → ../../proto/spooled.proto
2575
+ path.join(moduleDir, "../../proto/spooled.proto"),
2576
+ // Extra safety if moduleDir is package root
2577
+ path.join(moduleDir, "proto/spooled.proto")
2578
+ ];
2579
+ for (const candidate of candidates) {
2580
+ if (fs.existsSync(candidate)) {
2581
+ return candidate;
2582
+ }
2583
+ }
2584
+ throw new Error(
2585
+ `Spooled gRPC proto not found. Tried: ${candidates.join(", ")}. Ensure the package's proto/spooled.proto is installed next to dist/.`
2586
+ );
2569
2587
  }
2570
2588
  function loadProtoDefinition() {
2571
2589
  if (cachedDefinition) {
@@ -2754,7 +2772,29 @@ function decodeValue(value) {
2754
2772
  return void 0;
2755
2773
  }
2756
2774
  function encodeEnqueueRequest(params) {
2757
- return { ...params, payload: encodeStruct(params.payload) };
2775
+ const encoded = {
2776
+ queueName: params.queueName,
2777
+ payload: encodeStruct(params.payload)
2778
+ };
2779
+ if (params.priority !== void 0) {
2780
+ encoded.priority = params.priority;
2781
+ }
2782
+ if (params.maxRetries !== void 0) {
2783
+ encoded.maxRetries = params.maxRetries;
2784
+ }
2785
+ if (params.timeoutSeconds !== void 0) {
2786
+ encoded.timeoutSeconds = params.timeoutSeconds;
2787
+ }
2788
+ if (params.idempotencyKey !== void 0 && params.idempotencyKey !== "") {
2789
+ encoded.idempotencyKey = params.idempotencyKey;
2790
+ }
2791
+ if (params.scheduledAt !== void 0) {
2792
+ encoded.scheduledAt = params.scheduledAt;
2793
+ }
2794
+ if (params.tags !== void 0) {
2795
+ encoded.tags = params.tags;
2796
+ }
2797
+ return encoded;
2758
2798
  }
2759
2799
  function encodeCompleteRequest(params) {
2760
2800
  return { ...params, result: encodeStruct(params.result) };
@@ -3754,6 +3794,7 @@ exports.createPaginatedResponse = createPaginatedResponse;
3754
3794
  exports.createProcessJobsStream = createProcessJobsStream;
3755
3795
  exports.createRetryWrapper = createRetryWrapper;
3756
3796
  exports.dateToTimestamp = dateToTimestamp;
3797
+ exports.getProtoPath = getProtoPath;
3757
3798
  exports.isRetryableError = isRetryableError;
3758
3799
  exports.isSpooledError = isSpooledError;
3759
3800
  exports.loadProtoDefinition = loadProtoDefinition;