diff --git a/docs/advanced_initialization.md b/docs/advanced_initialization.md index 98bfae63..ed8e6765 100644 --- a/docs/advanced_initialization.md +++ b/docs/advanced_initialization.md @@ -92,7 +92,7 @@ const tertiaryVaultConfig: VaultConfig = { const skyflowConfig: SkyflowConfig = { vaultConfigs: [primaryVaultConfig, secondaryVaultConfig, tertiaryVaultConfig], // Add the primary, secondary and tertiary vault configurations. - skyflowCredentials: skyflowCredentials, // Add JSON-formatted credentials if applicable. + skyflowCredentials: { credentialsString: credentialsString }, // Use the stringified JSON credentials as the shared fallback credentials. logLevel: LogLevel.INFO, // Recommended to use LogLevel.ERROR in production environment. }; diff --git a/docs/api_reference.md b/docs/api_reference.md index e88f8e1a..19901b3b 100644 --- a/docs/api_reference.md +++ b/docs/api_reference.md @@ -206,7 +206,7 @@ Provide **exactly one** file source: `setFileObject`, `setFilePath`, or `setBase | Setter | Type | Description | |---|---|---| -| `setSkyflowId(id)` | `string` | **Required.** Skyflow ID of the record to attach the file to. | +| `setSkyflowId(id)` | `string` | Skyflow ID of the record to attach the file to. Omit to upload the file to a new record. | | `setFileObject(file)` | `File` | In-memory `File` object. | | `setFilePath(path)` | `string` | Path to a file on disk. Requires Node.js v20+. | | `setBase64(data)` | `string` | Base64-encoded file content. Use with `setFileName`. | diff --git a/docs/migrate_to_v2.md b/docs/migrate_to_v2.md index 7bd74101..4604e674 100644 --- a/docs/migrate_to_v2.md +++ b/docs/migrate_to_v2.md @@ -2,6 +2,9 @@ This guide outlines the steps required to migrate the Skyflow Node SDK from version 1 (V1) to version 2 (V2). +> [!IMPORTANT] +> V1 is in maintenance mode and will reach End of Life on October 31, 2026. Migrate to V2 before that date. + ## Authentication In V2, multiple authentication options have been introduced. You can now provide credentials in the following ways: @@ -28,6 +31,8 @@ const auth = function () { #### v2 Authentication: Credentials object +**Option 1: API key** + ```typescript import { Credentials } from 'skyflow-node'; @@ -36,16 +41,17 @@ const credentials: Credentials = { }; ``` -// Option 2: Environment Variables (Recommended) -// Set SKYFLOW_CREDENTIALS in your environment +**Option 2: Environment variable (recommended)** + +Set `SKYFLOW_CREDENTIALS` in your environment. The SDK reads it automatically when no credentials are passed. -// Option 3: Credentials File +**Option 3: Credentials file** ```typescript const credentials: Credentials = { path: "" }; ``` -// Option 4: Stringified JSON +**Option 4: Stringified JSON** ```typescript const credentials: Credentials = { @@ -53,7 +59,7 @@ const credentials: Credentials = { }; ``` -// Option 5: Bearer Token +**Option 5: Bearer token** ```typescript const credentials: Credentials = { token: "" }; @@ -124,10 +130,10 @@ const skyflowClient: Skyflow = new Skyflow(skyflowConfig); ### Request and Response Structure -In v2, with the introduction of TypeScript support, you can now pass an **InsertRequest** of type **InsertRequest**. This request requires: +In v2, with the introduction of TypeScript support, you can now pass an **InsertRequest** of type **InsertRequest**. Its constructor takes two positional arguments: -- **`tableName`**: The name of the table. -- **`insertData`**: An array of objects containing the data to be inserted +- **`table`**: The name of the table. +- **`data`**: An array of objects containing the data to insert. The response will be of type InsertResponse, which contains insertedFields and errors. diff --git a/skyvault/README.md b/skyvault/README.md index 5b7fcf29..d8bdb331 100644 --- a/skyvault/README.md +++ b/skyvault/README.md @@ -100,7 +100,7 @@ The Skyflow SDK enables you to connect to your Skyflow Vault(s) to securely hand ## Installation -Requires Node v12.22.12 and above. +Requires Node.js v18 and above. File operations (`uploadFile`, `deidentifyFile`) require Node.js v20 and above. ```sh npm install skyflow-node @@ -304,7 +304,7 @@ For all `InsertOptions` setters and `TokenMode` values, see [InsertOptions](../d Convert tokens back into plaintext values (or masked values) using the `.detokenize()` method. Detokenization accepts tokens and returns values. -Create a detokenization request with the [`DetokenizeRequest`](../docs/api_reference.md#detokenizerequest) class, which requires a list of tokens and column groups as input. +Create a detokenization request with the [`DetokenizeRequest`](../docs/api_reference.md#detokenizerequest) class, which requires a list of tokens as input, each with an optional redaction type. Provide optional parameters such as the redaction type and the option to continue on error. @@ -1084,7 +1084,7 @@ A `deidentifyFile` run that was accepted but failed while processing does not th ## Connections -Securely send and receive data between your systems and first- or third-party services using Skyflow Connections, a gateway service that uses tokenization. The [connections](https://github.com/skyflowapi/skyflow-node/tree/v2/src/vault/controller/connections) module invokes both inbound and outbound connections. +Securely send and receive data between your systems and first- or third-party services using Skyflow Connections, a gateway service that uses tokenization. The [connections](https://github.com/skyflowapi/skyflow-node/tree/main/skyvault/src/vault/controller/connections) module invokes both inbound and outbound connections. - **Inbound connections**: Act as intermediaries between your client and server, tokenizing sensitive data before it reaches your backend, ensuring downstream services handle only tokenized data. - **Outbound connections**: Enable secure extraction of data from the vault and transfer it to third-party services via your backend server, such as processing checkout or card issuance flows. @@ -1147,7 +1147,7 @@ Invoke connection response: { data: { status: 'success', transaction_id: 'txn_ab **pathParams, queryParams, header, body** are the JSON objects represented as dictionaries that will be sent through the connection integration url. > [!TIP] -> See the full example in the samples directory: [scoped-token-generation-example.ts](samples/vault-api/invoke-connection.ts) +> See the full example in the samples directory: [invoke-connection.ts](samples/vault-api/invoke-connection.ts) > See [docs.skyflow.com](https://docs.skyflow.com) for more details on integrations with Connections, Functions, and Pipelines. ## Authentication & authorization @@ -1204,7 +1204,7 @@ Generate and manage bearer tokens to authenticate API calls. This section covers #### Generate a bearer token -Generate service account tokens using the [Service Account](https://github.com/skyflowapi/skyflow-node/tree/v2/src/service-account) Node package with a service account credentials file provided when a service account is created. Tokens generated by this module are valid for 60 minutes and can be used to make API calls to the [Data](https://docs.skyflow.com/record/) and [Management](https://docs.skyflow.com/management/) APIs, depending on the permissions assigned to the service account. +Generate service account tokens using the [Service Account](https://github.com/skyflowapi/skyflow-node/tree/main/common/src/service-account) Node package with a service account credentials file provided when a service account is created. Tokens generated by this module are valid for 60 minutes and can be used to make API calls to the [Data](https://docs.skyflow.com/record/) and [Management](https://docs.skyflow.com/management/) APIs, depending on the permissions assigned to the service account. ##### `generateBearerToken(filepath)` @@ -1266,7 +1266,7 @@ if (expired) { ``` > [!TIP] -> See the full example in the samples directory: [token-generation-example.ts](http://github.com/skyflowapi/skyflow-node/blob/v2/samples/service-account/token-generation-example.ts) +> See the full example in the samples directory: [token-generation-example.ts](samples/service-account/token-generation-example.ts) #### Generate bearer tokens scoped to certain roles @@ -1525,7 +1525,7 @@ Most first-run problems come from configuration mismatches. Every error thrown b | Symptom | Likely cause | Fix | |---|---|---| -| `npm install skyflow-node` fails | Unsupported Node version | Requires Node v12.22.12 or above. | +| `npm install skyflow-node` fails | Unsupported Node version | Requires Node.js v18 or above. | | Connection/DNS failures, or 404 on every call | Wrong `clusterId` | `clusterId` is the first segment of your vault URL: `https://{clusterId}.vault.skyflowapis.com`. | | Requests hit the wrong host / unexpected auth failures | Wrong `env` | Match `env` to where your vault runs (`Env.PROD`, `Env.SANDBOX`, `Env.DEV`, `Env.STAGE`). | | `401 Unauthorized` | Invalid or expired credentials | Verify your API key or service-account credentials. Regenerate if needed. | diff --git a/skyvault/samples/README.md b/skyvault/samples/README.md index 7fc4c47f..2f8d14ae 100644 --- a/skyvault/samples/README.md +++ b/skyvault/samples/README.md @@ -5,7 +5,7 @@ Explore working examples that demonstrate common SDK operations. Start with basi ## Prerequisites - A Skyflow account. If you don't have one, register for one on the [Try Skyflow](https://skyflow.com/try-skyflow) page. -- [Node 7.6.0](https://nodejs.org/en/) and above. +- [Node.js](https://nodejs.org/en/) v18 and above. File-upload and de-identify-file samples require Node.js v20 and above. ## Prepare