Registry / type-stubs / oci-workrequests

oci-workrequests

JSON →
library2.130.0jsnpmunverified

The `oci-workrequests` package is an official Oracle Cloud Infrastructure (OCI) Node.js/TypeScript client specifically designed to interact with the OCI Work Requests service. Currently at version 2.130.0, this package is part of the broader OCI TypeScript SDK and receives very frequent updates, often on a daily or weekly basis, reflecting continuous feature development and alignment with new OCI service capabilities. It provides a type-safe and idiomatic interface for managing asynchronous operations within OCI, allowing developers to programmatically monitor the status and outcomes of long-running tasks across various OCI services. Key differentiators include its tight integration with the OCI ecosystem, comprehensive type definitions, and adherence to OCI's API standards, simplifying the development of robust cloud automation and management scripts.

npm install oci-workrequests
INSTALL
IMPORT
SIG · OCI-WORKREQUESTS
O
oci-workrequests
type-stubsjavascriptv2.130.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WorkRequestsClient
import { WorkRequestsClient } from 'oci-workrequests';
const WorkRequestsClient = require('oci-workrequests');
The OCI SDK primarily targets modern TypeScript/ESM environments. While CommonJS might work with transpilation, direct require is less common and types will be lost.
common
import * as common from 'oci-common';
import common from 'oci-common';
The `oci-common` module exports many utilities, including authentication providers, as named exports. It's typically imported as a namespace.
ListWorkRequestsRequest
import { requests } from 'oci-workrequests'; const request: requests.ListWorkRequestsRequest = { /* ... */ };
Request and response types for service operations are typically nested under a 'requests' or 'responses' namespace within the service module.

This code initializes the WorkRequests client and lists the first 10 work requests in a specified compartment, demonstrating basic API interaction.

import { WorkRequestsClient } from 'oci-workrequests'; import * as common from 'oci-common'; import { requests } from 'oci-workrequests'; async function listAllWorkRequests(): Promise<void> { try { // Configure authentication using default provider (e.g., OCI config file or instance principal) const provider = new common.auth.DefaultAuthenticationDetailsProvider(); // Initialize the WorkRequests client const client = new WorkRequestsClient({ authenticationDetailsProvider: provider }); // Define the request to list work requests // Replace 'ocid1.compartment.oc1..aaaaaaaaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' with your compartment OCID const listRequest: requests.ListWorkRequestsRequest = { compartmentId: process.env.OCI_COMPARTMENT_ID ?? 'ocid1.compartment.oc1..aaaaaaaaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // You can add filters like status, resourceId, etc. limit: 10 // Limit to 10 results for brevity }; // Call the ListWorkRequests API console.log('Listing OCI Work Requests...'); let response = await client.listWorkRequests(listRequest); if (response.items && response.items.length > 0) { console.log(`Found ${response.items.length} work requests:`) for (const wr of response.items) { console.log(` ID: ${wr.id}, Status: ${wr.status}, Resource: ${wr.resources ? wr.resources[0]?.identifier : 'N/A'}`); } } else { console.log('No work requests found in the specified compartment.'); } } catch (error) { console.error('Error listing work requests:', error); } } listAllWorkRequests();
Debug
Known issues
gotchaOCI SDK authentication can be complex, requiring a correctly configured `~/.oci/config` file, instance principals for compute instances, or session tokens for Cloud Shell. Incorrect setup is a common source of errors.
fix
Ensure your `~/.oci/config` file is properly configured with `user`, `fingerprint`, `key_file`, and `tenancy` details, or ensure your compute instance has appropriate instance principal policies.
affects: >=2.0.0
breakingMajor version updates to the overall OCI SDK (e.g., from v2 to v3) often involve significant changes to module structure, authentication patterns, or API interfaces, requiring code adjustments.
fix
Always review the release notes for the main `oci-typescript-sdk` repository before upgrading major versions. Pin exact major versions in your `package.json` to avoid unexpected breaking changes.
affects: >=2.0.0
gotchaThe `oci-workrequests` package (and other service-specific packages) receives very frequent updates. While this brings new features, it can also introduce subtle behavior changes or dependency conflicts if not managed carefully.
fix
Regularly update your dependencies and test thoroughly. Consider using a dependency management tool that allows for minor version updates (`^2.130.0`) but prevents major shifts, or pin specific versions if stability is paramount.
affects: >=2.0.0
gotchaOCI API calls, especially for listing operations, often require a `compartmentId`. Forgetting this or providing an incorrect OCID will result in unauthorized or not found errors.
fix
Always ensure the required `compartmentId` is provided in request objects and that the provided OCID is correct and accessible by the authenticated user.
affects: >=2.0.0
Errors
Common errors & fixes
Error: NotAuthenticated: The required information to complete authentication was not supplied.
The authentication details provider could not find valid credentials (e.g., `~/.oci/config` file missing or malformed, environment variables not set).
fix
Verify your OCI configuration file (`~/.oci/config`) exists and is correctly formatted, or ensure environment variables like `OCI_CLI_PROFILE` and `OCI_CLI_CONFIG_FILE` are set if using a non-default profile/location.
Error: ServiceError: Authorization failed or requested resource not found. (opc-request-id: <request-id>)
The authenticated user lacks the necessary IAM policies to perform the requested operation, or the specified resource (e.g., compartmentId) does not exist or is incorrect.
fix
Check your OCI IAM policies to ensure the user or instance principal has permissions for the Work Requests service. Double-check the OCIDs used in your request for correctness.
TypeError: Cannot read properties of undefined (reading 'WorkRequestsClient')
Incorrect import statement or `oci-workrequests` package not installed or incorrectly resolved by Node.js/TypeScript.
fix
Ensure `npm install oci-workrequests` has been run successfully and your import statement is `import { WorkRequestsClient } from 'oci-workrequests';`.
Upgrade
Version history
2.130.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
21 hits · last 30 days
node
20
OpenAI (training)
1
Resources