@open-captable-protocol/canton 0.2.149 → 0.2.151
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/dist/OcpClient.d.ts +11 -0
- package/dist/OcpClient.d.ts.map +1 -1
- package/dist/OcpClient.js +3 -0
- package/dist/OcpClient.js.map +1 -1
- package/dist/errors/OcpContractError.d.ts +52 -0
- package/dist/errors/OcpContractError.d.ts.map +1 -0
- package/dist/errors/OcpContractError.js +45 -0
- package/dist/errors/OcpContractError.js.map +1 -0
- package/dist/errors/OcpError.d.ts +27 -0
- package/dist/errors/OcpError.d.ts.map +1 -0
- package/dist/errors/OcpError.js +33 -0
- package/dist/errors/OcpError.js.map +1 -0
- package/dist/errors/OcpNetworkError.d.ts +49 -0
- package/dist/errors/OcpNetworkError.d.ts.map +1 -0
- package/dist/errors/OcpNetworkError.js +45 -0
- package/dist/errors/OcpNetworkError.js.map +1 -0
- package/dist/errors/OcpParseError.d.ts +41 -0
- package/dist/errors/OcpParseError.d.ts.map +1 -0
- package/dist/errors/OcpParseError.js +40 -0
- package/dist/errors/OcpParseError.js.map +1 -0
- package/dist/errors/OcpValidationError.d.ts +49 -0
- package/dist/errors/OcpValidationError.d.ts.map +1 -0
- package/dist/errors/OcpValidationError.js +46 -0
- package/dist/errors/OcpValidationError.js.map +1 -0
- package/dist/errors/codes.d.ts +23 -0
- package/dist/errors/codes.d.ts.map +1 -0
- package/dist/errors/codes.js +29 -0
- package/dist/errors/codes.js.map +1 -0
- package/dist/errors/index.d.ts +48 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +59 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/functions/CouponMinter/index.d.ts +1 -0
- package/dist/functions/CouponMinter/index.d.ts.map +1 -1
- package/dist/functions/CouponMinter/index.js +7 -1
- package/dist/functions/CouponMinter/index.js.map +1 -1
- package/dist/functions/CouponMinter/waitUntilCanMint.d.ts +176 -0
- package/dist/functions/CouponMinter/waitUntilCanMint.d.ts.map +1 -0
- package/dist/functions/CouponMinter/waitUntilCanMint.js +233 -0
- package/dist/functions/CouponMinter/waitUntilCanMint.js.map +1 -0
- package/dist/functions/OpenCapTable/capTable/CapTableBatch.d.ts +2 -1
- package/dist/functions/OpenCapTable/capTable/CapTableBatch.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/capTable/CapTableBatch.js +14 -4
- package/dist/functions/OpenCapTable/capTable/CapTableBatch.js.map +1 -1
- package/dist/functions/OpenCapTable/capTable/ocfToDaml.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/capTable/ocfToDaml.js +151 -50
- package/dist/functions/OpenCapTable/capTable/ocfToDaml.js.map +1 -1
- package/dist/functions/OpenCapTable/issuer/createIssuer.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/issuer/createIssuer.js +15 -4
- package/dist/functions/OpenCapTable/issuer/createIssuer.js.map +1 -1
- package/dist/functions/OpenCapTable/stakeholder/getStakeholderAsOcf.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/stakeholder/getStakeholderAsOcf.js +21 -5
- package/dist/functions/OpenCapTable/stakeholder/getStakeholderAsOcf.js.map +1 -1
- package/dist/functions/OpenCapTable/stakeholder/stakeholderDataToDaml.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/stakeholder/stakeholderDataToDaml.js +19 -5
- package/dist/functions/OpenCapTable/stakeholder/stakeholderDataToDaml.js.map +1 -1
- package/dist/functions/OpenCapTable/stockClass/stockClassDataToDaml.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/stockClass/stockClassDataToDaml.js +11 -3
- package/dist/functions/OpenCapTable/stockClass/stockClassDataToDaml.js.map +1 -1
- package/dist/functions/OpenCapTable/stockIssuance/createStockIssuance.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/stockIssuance/createStockIssuance.js +35 -11
- package/dist/functions/OpenCapTable/stockIssuance/createStockIssuance.js.map +1 -1
- package/dist/functions/OpenCapTable/stockRepurchase/stockRepurchaseDataToDaml.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/stockRepurchase/stockRepurchaseDataToDaml.js +19 -6
- package/dist/functions/OpenCapTable/stockRepurchase/stockRepurchaseDataToDaml.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/typeConversions.d.ts +1 -1
- package/dist/utils/typeConversions.d.ts.map +1 -1
- package/dist/utils/typeConversions.js +23 -6
- package/dist/utils/typeConversions.js.map +1 -1
- package/package.json +1 -1
package/dist/OcpClient.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { DisclosedContract } from '@fairmint/canton-node-sdk/build/src/clie
|
|
|
4
4
|
import { TransactionBatch } from '@fairmint/canton-node-sdk/build/src/utils/transactions';
|
|
5
5
|
import { type CantonPaymentsMethods, type PaymentStreamsMethods } from './extensions';
|
|
6
6
|
import { type AuthorizeIssuerParams, type AuthorizeIssuerResult, type CanMintResult, type CouponMinterPayload, type CreateCompanyValuationReportParams, type CreateCompanyValuationReportResult, type CreateIssuerParams, type GetConvertibleCancellationEventAsOcfParams, type GetConvertibleCancellationEventAsOcfResult, type GetConvertibleIssuanceAsOcfParams, type GetConvertibleIssuanceAsOcfResult, type GetDocumentAsOcfParams, type GetDocumentAsOcfResult, type GetEquityCompensationCancellationEventAsOcfParams, type GetEquityCompensationCancellationEventAsOcfResult, type GetEquityCompensationExerciseEventAsOcfParams, type GetEquityCompensationExerciseEventAsOcfResult, type GetEquityCompensationIssuanceEventAsOcfParams, type GetEquityCompensationIssuanceEventAsOcfResult, type GetIssuerAsOcfParams, type GetIssuerAsOcfResult, type GetIssuerAuthorizedSharesAdjustmentEventAsOcfParams, type GetIssuerAuthorizedSharesAdjustmentEventAsOcfResult, type GetStakeholderAsOcfParams, type GetStakeholderAsOcfResult, type GetStockCancellationEventAsOcfParams, type GetStockCancellationEventAsOcfResult, type GetStockClassAsOcfParams, type GetStockClassAsOcfResult, type GetStockClassAuthorizedSharesAdjustmentEventAsOcfParams, type GetStockClassAuthorizedSharesAdjustmentEventAsOcfResult, type GetStockIssuanceAsOcfParams, type GetStockIssuanceAsOcfResult, type GetStockLegendTemplateAsOcfParams, type GetStockLegendTemplateAsOcfResult, type GetStockPlanAsOcfParams, type GetStockPlanAsOcfResult, type GetStockPlanPoolAdjustmentEventAsOcfParams, type GetStockPlanPoolAdjustmentEventAsOcfResult, type GetStockRepurchaseAsOcfParams, type GetStockRepurchaseAsOcfResult, type GetStockTransferAsOcfParams, type GetStockTransferAsOcfResult, type GetVestingTermsAsOcfParams, type GetVestingTermsAsOcfResult, type GetWarrantCancellationEventAsOcfParams, type GetWarrantCancellationEventAsOcfResult, type GetWarrantIssuanceAsOcfParams, type GetWarrantIssuanceAsOcfResult, type UpdateCompanyValuationParams, type UpdateCompanyValuationResult, type WithdrawAuthorizationParams, type WithdrawAuthorizationResult } from './functions';
|
|
7
|
+
import { type MintWithRateLimitOptions, type MintWithRateLimitResult, type WaitUntilCanMintOptions } from './functions/CouponMinter';
|
|
7
8
|
import { CapTableBatch } from './functions/OpenCapTable/capTable';
|
|
8
9
|
import type { CommandWithDisclosedContracts } from './types';
|
|
9
10
|
/**
|
|
@@ -256,7 +257,17 @@ interface OpenCapTableReportsMethods {
|
|
|
256
257
|
};
|
|
257
258
|
}
|
|
258
259
|
interface CouponMinterMethods {
|
|
260
|
+
/** Check if minting is currently allowed based on rate limits */
|
|
259
261
|
canMintCouponsNow: (payload: CouponMinterPayload, now?: Date) => CanMintResult;
|
|
262
|
+
/** Get detailed rate limit status with additional context */
|
|
263
|
+
getRateLimitStatus: (payload: CouponMinterPayload, now?: Date) => CanMintResult & {
|
|
264
|
+
waitSeconds?: number;
|
|
265
|
+
isRateLimitEnabled: boolean;
|
|
266
|
+
};
|
|
267
|
+
/** Wait until minting is allowed, sleeping as needed */
|
|
268
|
+
waitUntilCanMint: (payload: CouponMinterPayload, options?: WaitUntilCanMintOptions) => Promise<void>;
|
|
269
|
+
/** Wait for rate limit then execute mint function (fire and forget style) */
|
|
270
|
+
mintWithRateLimit: <T>(payload: CouponMinterPayload, mintFn: () => Promise<T>, options?: MintWithRateLimitOptions) => Promise<MintWithRateLimitResult<T>>;
|
|
260
271
|
}
|
|
261
272
|
/** PaymentStreams methods with client already bound for utils */
|
|
262
273
|
interface PaymentStreamsMethodsWithClient extends Omit<PaymentStreamsMethods, 'utils'> {
|
package/dist/OcpClient.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OcpClient.d.ts","sourceRoot":"","sources":["../src/OcpClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,6DAA6D,CAAC;AAClG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kFAAkF,CAAC;AAC1H,OAAO,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAC;AAC1F,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EA6BL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,kCAAkC,EACvC,KAAK,kCAAkC,EACvC,KAAK,kBAAkB,EACvB,KAAK,0CAA0C,EAC/C,KAAK,0CAA0C,EAC/C,KAAK,iCAAiC,EACtC,KAAK,iCAAiC,EACtC,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,iDAAiD,EACtD,KAAK,iDAAiD,EACtD,KAAK,6CAA6C,EAClD,KAAK,6CAA6C,EAClD,KAAK,6CAA6C,EAClD,KAAK,6CAA6C,EAClD,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,mDAAmD,EACxD,KAAK,mDAAmD,EACxD,KAAK,yBAAyB,EAC9B,KAAK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AO,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAClC,mBAAmB,EAAE,CACnB,eAAe,EAAE,kBAAkB,EACnC,QAAQ,EAAE,MAAM,KACb,OAAO,CAAC,OAAO,iDAAiD,EAAE,oCAAoC,CAAC,CAAC;QAC7G,8BAA8B,EAAE,CAC9B,eAAe,EAAE,kBAAkB,EACnC,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,MAAM,KACb,OAAO,CAAC,OAAO,iDAAiD,EAAE,qCAAqC,CAAC,CAAC;KAC/G,CAAC;CACH"}
|
package/dist/OcpClient.js
CHANGED
|
@@ -168,6 +168,9 @@ class OcpClient {
|
|
|
168
168
|
// Initialize CouponMinter methods
|
|
169
169
|
this.CouponMinter = {
|
|
170
170
|
canMintCouponsNow: (payload, now) => (0, CouponMinter_1.canMintCouponsNow)(payload, now),
|
|
171
|
+
getRateLimitStatus: (payload, now) => (0, CouponMinter_1.getRateLimitStatus)(payload, now),
|
|
172
|
+
waitUntilCanMint: async (payload, options) => (0, CouponMinter_1.waitUntilCanMint)(payload, options),
|
|
173
|
+
mintWithRateLimit: async (payload, mintFn, options) => (0, CouponMinter_1.mintWithRateLimit)(payload, mintFn, options),
|
|
171
174
|
};
|
|
172
175
|
// Initialize extensions
|
|
173
176
|
this.CantonPayments = (0, extensions_1.createCantonPaymentsExtension)();
|
package/dist/OcpClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OcpClient.js","sourceRoot":"","sources":["../src/OcpClient.ts"],"names":[],"mappings":";;;AACA,iGAAkG;AAElG,yFAA0F;AAC1F,6CAKsB;AACtB,2CAkFqB;AACrB,
|
|
1
|
+
{"version":3,"file":"OcpClient.js","sourceRoot":"","sources":["../src/OcpClient.ts"],"names":[],"mappings":";;;AACA,iGAAkG;AAElG,yFAA0F;AAC1F,6CAKsB;AACtB,2CAkFqB;AACrB,2DAQkC;AAClC,gEAAkE;AAgClE;;;;GAIG;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,EACN,+BAA+B,EAC/B,MAAM,CACP;aACJ;SACF,CAAC;IACJ,CAAC;CACF;AArND,8BAqNC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type OcpErrorCode } from './codes';
|
|
2
|
+
import { OcpError } from './OcpError';
|
|
3
|
+
export interface OcpContractErrorOptions {
|
|
4
|
+
/** The contract ID involved in the error */
|
|
5
|
+
contractId?: string;
|
|
6
|
+
/** The DAML template ID */
|
|
7
|
+
templateId?: string;
|
|
8
|
+
/** The choice being exercised when the error occurred */
|
|
9
|
+
choice?: string;
|
|
10
|
+
/** The original error that caused this error */
|
|
11
|
+
cause?: Error;
|
|
12
|
+
/** Specific contract error code (defaults to CHOICE_FAILED) */
|
|
13
|
+
code?: OcpErrorCode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Errors from Canton/DAML contract interactions.
|
|
17
|
+
*
|
|
18
|
+
* Thrown when contract operations fail, such as exercising a choice,
|
|
19
|
+
* fetching contract data, or when expected results are not found in
|
|
20
|
+
* transaction trees.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* throw new OcpContractError('UpdateCapTable result not found in transaction tree', {
|
|
25
|
+
* contractId: capTableContractId,
|
|
26
|
+
* choice: 'UpdateCapTable',
|
|
27
|
+
* code: OcpErrorCodes.RESULT_NOT_FOUND,
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example Catching contract errors
|
|
32
|
+
* ```typescript
|
|
33
|
+
* try {
|
|
34
|
+
* await ocp.OpenCapTable.capTable.update(...).execute();
|
|
35
|
+
* } catch (error) {
|
|
36
|
+
* if (error instanceof OcpContractError) {
|
|
37
|
+
* console.error(`Contract error on ${error.choice}: ${error.message}`);
|
|
38
|
+
* console.error(`Contract ID: ${error.contractId}`);
|
|
39
|
+
* }
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare class OcpContractError extends OcpError {
|
|
44
|
+
/** The contract ID involved in the error */
|
|
45
|
+
readonly contractId?: string;
|
|
46
|
+
/** The DAML template ID */
|
|
47
|
+
readonly templateId?: string;
|
|
48
|
+
/** The choice being exercised when the error occurred */
|
|
49
|
+
readonly choice?: string;
|
|
50
|
+
constructor(message: string, options?: OcpContractErrorOptions);
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=OcpContractError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OcpContractError.d.ts","sourceRoot":"","sources":["../../src/errors/OcpContractError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,WAAW,uBAAuB;IACtC,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2BAA2B;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,+DAA+D;IAC/D,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;IAC5C,4CAA4C;IAC5C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE7B,2BAA2B;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE7B,yDAAyD;IACzD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;gBAEb,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,uBAAuB;CAQ/D"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OcpContractError = void 0;
|
|
4
|
+
const codes_1 = require("./codes");
|
|
5
|
+
const OcpError_1 = require("./OcpError");
|
|
6
|
+
/**
|
|
7
|
+
* Errors from Canton/DAML contract interactions.
|
|
8
|
+
*
|
|
9
|
+
* Thrown when contract operations fail, such as exercising a choice,
|
|
10
|
+
* fetching contract data, or when expected results are not found in
|
|
11
|
+
* transaction trees.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* throw new OcpContractError('UpdateCapTable result not found in transaction tree', {
|
|
16
|
+
* contractId: capTableContractId,
|
|
17
|
+
* choice: 'UpdateCapTable',
|
|
18
|
+
* code: OcpErrorCodes.RESULT_NOT_FOUND,
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @example Catching contract errors
|
|
23
|
+
* ```typescript
|
|
24
|
+
* try {
|
|
25
|
+
* await ocp.OpenCapTable.capTable.update(...).execute();
|
|
26
|
+
* } catch (error) {
|
|
27
|
+
* if (error instanceof OcpContractError) {
|
|
28
|
+
* console.error(`Contract error on ${error.choice}: ${error.message}`);
|
|
29
|
+
* console.error(`Contract ID: ${error.contractId}`);
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
class OcpContractError extends OcpError_1.OcpError {
|
|
35
|
+
constructor(message, options) {
|
|
36
|
+
const code = options?.code ?? codes_1.OcpErrorCodes.CHOICE_FAILED;
|
|
37
|
+
super(message, code, options?.cause);
|
|
38
|
+
this.name = 'OcpContractError';
|
|
39
|
+
this.contractId = options?.contractId;
|
|
40
|
+
this.templateId = options?.templateId;
|
|
41
|
+
this.choice = options?.choice;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.OcpContractError = OcpContractError;
|
|
45
|
+
//# sourceMappingURL=OcpContractError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OcpContractError.js","sourceRoot":"","sources":["../../src/errors/OcpContractError.ts"],"names":[],"mappings":";;;AAAA,mCAA2D;AAC3D,yCAAsC;AAetC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAa,gBAAiB,SAAQ,mBAAQ;IAU5C,YAAY,OAAe,EAAE,OAAiC;QAC5D,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,qBAAa,CAAC,aAAa,CAAC;QAC1D,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE,UAAU,CAAC;QACtC,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE,UAAU,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;IAChC,CAAC;CACF;AAlBD,4CAkBC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { OcpErrorCode } from './codes';
|
|
2
|
+
/**
|
|
3
|
+
* Base error class for all OCP SDK errors.
|
|
4
|
+
*
|
|
5
|
+
* Provides structured error information including an error code and optional cause.
|
|
6
|
+
* All OCP-specific errors extend this class, allowing consumers to catch all SDK
|
|
7
|
+
* errors with a single `catch (error instanceof OcpError)` check.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* try {
|
|
12
|
+
* await ocp.OpenCapTable.issuer.createIssuer(params);
|
|
13
|
+
* } catch (error) {
|
|
14
|
+
* if (error instanceof OcpError) {
|
|
15
|
+
* console.error(`OCP Error [${error.code}]: ${error.message}`);
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class OcpError extends Error {
|
|
21
|
+
/** Error code for programmatic handling */
|
|
22
|
+
readonly code: OcpErrorCode;
|
|
23
|
+
/** The original error that caused this error, if any */
|
|
24
|
+
readonly cause?: Error;
|
|
25
|
+
constructor(message: string, code: OcpErrorCode, cause?: Error);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=OcpError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OcpError.d.ts","sourceRoot":"","sources":["../../src/errors/OcpError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACjC,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAE5B,wDAAwD;IACxD,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;gBAEX,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,EAAE,KAAK;CAS/D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OcpError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Base error class for all OCP SDK errors.
|
|
6
|
+
*
|
|
7
|
+
* Provides structured error information including an error code and optional cause.
|
|
8
|
+
* All OCP-specific errors extend this class, allowing consumers to catch all SDK
|
|
9
|
+
* errors with a single `catch (error instanceof OcpError)` check.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* try {
|
|
14
|
+
* await ocp.OpenCapTable.issuer.createIssuer(params);
|
|
15
|
+
* } catch (error) {
|
|
16
|
+
* if (error instanceof OcpError) {
|
|
17
|
+
* console.error(`OCP Error [${error.code}]: ${error.message}`);
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
class OcpError extends Error {
|
|
23
|
+
constructor(message, code, cause) {
|
|
24
|
+
super(message);
|
|
25
|
+
this.name = 'OcpError';
|
|
26
|
+
this.code = code;
|
|
27
|
+
this.cause = cause;
|
|
28
|
+
// Maintain proper stack trace in V8 environments (Node.js, Chrome)
|
|
29
|
+
Error.captureStackTrace(this, this.constructor);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.OcpError = OcpError;
|
|
33
|
+
//# sourceMappingURL=OcpError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OcpError.js","sourceRoot":"","sources":["../../src/errors/OcpError.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAa,QAAS,SAAQ,KAAK;IAOjC,YAAY,OAAe,EAAE,IAAkB,EAAE,KAAa;QAC5D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,mEAAmE;QACnE,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;CACF;AAhBD,4BAgBC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type OcpErrorCode } from './codes';
|
|
2
|
+
import { OcpError } from './OcpError';
|
|
3
|
+
export interface OcpNetworkErrorOptions {
|
|
4
|
+
/** The endpoint that was being accessed */
|
|
5
|
+
endpoint?: string;
|
|
6
|
+
/** The HTTP status code, if applicable */
|
|
7
|
+
statusCode?: number;
|
|
8
|
+
/** The original error that caused this error */
|
|
9
|
+
cause?: Error;
|
|
10
|
+
/** Specific network error code (defaults to CONNECTION_FAILED) */
|
|
11
|
+
code?: OcpErrorCode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Network or connectivity errors.
|
|
15
|
+
*
|
|
16
|
+
* Thrown when network operations fail, such as connection failures,
|
|
17
|
+
* timeouts, or rate limiting.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* throw new OcpNetworkError('Failed to connect to Canton JSON API', {
|
|
22
|
+
* endpoint: 'http://localhost:3975',
|
|
23
|
+
* code: OcpErrorCodes.CONNECTION_FAILED,
|
|
24
|
+
* cause: originalError,
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example Catching network errors
|
|
29
|
+
* ```typescript
|
|
30
|
+
* try {
|
|
31
|
+
* await ocp.OpenCapTable.issuer.getIssuerAsOcf(params);
|
|
32
|
+
* } catch (error) {
|
|
33
|
+
* if (error instanceof OcpNetworkError) {
|
|
34
|
+
* console.error(`Network error: ${error.message}`);
|
|
35
|
+
* if (error.statusCode === 503) {
|
|
36
|
+
* console.error('Service unavailable - retry later');
|
|
37
|
+
* }
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare class OcpNetworkError extends OcpError {
|
|
43
|
+
/** The endpoint that was being accessed */
|
|
44
|
+
readonly endpoint?: string;
|
|
45
|
+
/** The HTTP status code, if applicable */
|
|
46
|
+
readonly statusCode?: number;
|
|
47
|
+
constructor(message: string, options?: OcpNetworkErrorOptions);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=OcpNetworkError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OcpNetworkError.d.ts","sourceRoot":"","sources":["../../src/errors/OcpNetworkError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,WAAW,sBAAsB;IACrC,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,kEAAkE;IAClE,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;IAC3C,2CAA2C;IAC3C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE3B,0CAA0C;IAC1C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;gBAEjB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,sBAAsB;CAO9D"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OcpNetworkError = void 0;
|
|
4
|
+
const codes_1 = require("./codes");
|
|
5
|
+
const OcpError_1 = require("./OcpError");
|
|
6
|
+
/**
|
|
7
|
+
* Network or connectivity errors.
|
|
8
|
+
*
|
|
9
|
+
* Thrown when network operations fail, such as connection failures,
|
|
10
|
+
* timeouts, or rate limiting.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* throw new OcpNetworkError('Failed to connect to Canton JSON API', {
|
|
15
|
+
* endpoint: 'http://localhost:3975',
|
|
16
|
+
* code: OcpErrorCodes.CONNECTION_FAILED,
|
|
17
|
+
* cause: originalError,
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @example Catching network errors
|
|
22
|
+
* ```typescript
|
|
23
|
+
* try {
|
|
24
|
+
* await ocp.OpenCapTable.issuer.getIssuerAsOcf(params);
|
|
25
|
+
* } catch (error) {
|
|
26
|
+
* if (error instanceof OcpNetworkError) {
|
|
27
|
+
* console.error(`Network error: ${error.message}`);
|
|
28
|
+
* if (error.statusCode === 503) {
|
|
29
|
+
* console.error('Service unavailable - retry later');
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
class OcpNetworkError extends OcpError_1.OcpError {
|
|
36
|
+
constructor(message, options) {
|
|
37
|
+
const code = options?.code ?? codes_1.OcpErrorCodes.CONNECTION_FAILED;
|
|
38
|
+
super(message, code, options?.cause);
|
|
39
|
+
this.name = 'OcpNetworkError';
|
|
40
|
+
this.endpoint = options?.endpoint;
|
|
41
|
+
this.statusCode = options?.statusCode;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.OcpNetworkError = OcpNetworkError;
|
|
45
|
+
//# sourceMappingURL=OcpNetworkError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OcpNetworkError.js","sourceRoot":"","sources":["../../src/errors/OcpNetworkError.ts"],"names":[],"mappings":";;;AAAA,mCAA2D;AAC3D,yCAAsC;AAatC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAa,eAAgB,SAAQ,mBAAQ;IAO3C,YAAY,OAAe,EAAE,OAAgC;QAC3D,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,qBAAa,CAAC,iBAAiB,CAAC;QAC9D,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,OAAO,EAAE,QAAQ,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE,UAAU,CAAC;IACxC,CAAC;CACF;AAdD,0CAcC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type OcpErrorCode } from './codes';
|
|
2
|
+
import { OcpError } from './OcpError';
|
|
3
|
+
export interface OcpParseErrorOptions {
|
|
4
|
+
/** Description of the data source being parsed */
|
|
5
|
+
source?: string;
|
|
6
|
+
/** The original error that caused this error */
|
|
7
|
+
cause?: Error;
|
|
8
|
+
/** Specific parse error code (defaults to INVALID_RESPONSE) */
|
|
9
|
+
code?: OcpErrorCode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Errors from parsing or transforming data.
|
|
13
|
+
*
|
|
14
|
+
* Thrown when data cannot be parsed or transformed, such as invalid
|
|
15
|
+
* DAML responses, unknown enum values, or schema mismatches.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* throw new OcpParseError('Unknown DAML stakeholder type: InvalidType', {
|
|
20
|
+
* source: 'stakeholder.stakeholder_type',
|
|
21
|
+
* code: OcpErrorCodes.UNKNOWN_ENUM_VALUE,
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example Catching parse errors
|
|
26
|
+
* ```typescript
|
|
27
|
+
* try {
|
|
28
|
+
* const result = await ocp.OpenCapTable.stakeholder.getStakeholderAsOcf(params);
|
|
29
|
+
* } catch (error) {
|
|
30
|
+
* if (error instanceof OcpParseError) {
|
|
31
|
+
* console.error(`Parse error in ${error.source}: ${error.message}`);
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare class OcpParseError extends OcpError {
|
|
37
|
+
/** Description of the data source being parsed */
|
|
38
|
+
readonly source?: string;
|
|
39
|
+
constructor(message: string, options?: OcpParseErrorOptions);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=OcpParseError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OcpParseError.d.ts","sourceRoot":"","sources":["../../src/errors/OcpParseError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,WAAW,oBAAoB;IACnC,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,+DAA+D;IAC/D,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,aAAc,SAAQ,QAAQ;IACzC,kDAAkD;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;gBAEb,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB;CAM5D"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OcpParseError = void 0;
|
|
4
|
+
const codes_1 = require("./codes");
|
|
5
|
+
const OcpError_1 = require("./OcpError");
|
|
6
|
+
/**
|
|
7
|
+
* Errors from parsing or transforming data.
|
|
8
|
+
*
|
|
9
|
+
* Thrown when data cannot be parsed or transformed, such as invalid
|
|
10
|
+
* DAML responses, unknown enum values, or schema mismatches.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* throw new OcpParseError('Unknown DAML stakeholder type: InvalidType', {
|
|
15
|
+
* source: 'stakeholder.stakeholder_type',
|
|
16
|
+
* code: OcpErrorCodes.UNKNOWN_ENUM_VALUE,
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @example Catching parse errors
|
|
21
|
+
* ```typescript
|
|
22
|
+
* try {
|
|
23
|
+
* const result = await ocp.OpenCapTable.stakeholder.getStakeholderAsOcf(params);
|
|
24
|
+
* } catch (error) {
|
|
25
|
+
* if (error instanceof OcpParseError) {
|
|
26
|
+
* console.error(`Parse error in ${error.source}: ${error.message}`);
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
class OcpParseError extends OcpError_1.OcpError {
|
|
32
|
+
constructor(message, options) {
|
|
33
|
+
const code = options?.code ?? codes_1.OcpErrorCodes.INVALID_RESPONSE;
|
|
34
|
+
super(message, code, options?.cause);
|
|
35
|
+
this.name = 'OcpParseError';
|
|
36
|
+
this.source = options?.source;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.OcpParseError = OcpParseError;
|
|
40
|
+
//# sourceMappingURL=OcpParseError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OcpParseError.js","sourceRoot":"","sources":["../../src/errors/OcpParseError.ts"],"names":[],"mappings":";;;AAAA,mCAA2D;AAC3D,yCAAsC;AAWtC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,aAAc,SAAQ,mBAAQ;IAIzC,YAAY,OAAe,EAAE,OAA8B;QACzD,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,qBAAa,CAAC,gBAAgB,CAAC;QAC7D,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;IAChC,CAAC;CACF;AAVD,sCAUC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type OcpErrorCode } from './codes';
|
|
2
|
+
import { OcpError } from './OcpError';
|
|
3
|
+
export interface OcpValidationErrorOptions {
|
|
4
|
+
/** The expected type for this field */
|
|
5
|
+
expectedType?: string;
|
|
6
|
+
/** The actual value received */
|
|
7
|
+
receivedValue?: unknown;
|
|
8
|
+
/** Specific validation error code (defaults to REQUIRED_FIELD_MISSING) */
|
|
9
|
+
code?: OcpErrorCode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Validation errors for invalid input data.
|
|
13
|
+
*
|
|
14
|
+
* Thrown when input data fails validation before being sent to DAML contracts.
|
|
15
|
+
* Includes the field path where validation failed and optionally the expected
|
|
16
|
+
* type and received value.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* if (!data.id) {
|
|
21
|
+
* throw new OcpValidationError('stakeholder.id', 'Required field is missing or empty', {
|
|
22
|
+
* expectedType: 'string',
|
|
23
|
+
* receivedValue: data.id,
|
|
24
|
+
* });
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example Catching validation errors
|
|
29
|
+
* ```typescript
|
|
30
|
+
* try {
|
|
31
|
+
* await ocp.OpenCapTable.capTable.update(...).create('stakeholder', data).execute();
|
|
32
|
+
* } catch (error) {
|
|
33
|
+
* if (error instanceof OcpValidationError) {
|
|
34
|
+
* console.error(`Validation failed at '${error.fieldPath}': ${error.message}`);
|
|
35
|
+
* console.error(`Expected: ${error.expectedType}, Got: ${error.receivedValue}`);
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare class OcpValidationError extends OcpError {
|
|
41
|
+
/** The dot-separated path to the field that failed validation */
|
|
42
|
+
readonly fieldPath: string;
|
|
43
|
+
/** The expected type for this field, if applicable */
|
|
44
|
+
readonly expectedType?: string;
|
|
45
|
+
/** The actual value that was received */
|
|
46
|
+
readonly receivedValue?: unknown;
|
|
47
|
+
constructor(fieldPath: string, message: string, options?: OcpValidationErrorOptions);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=OcpValidationError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OcpValidationError.d.ts","sourceRoot":"","sources":["../../src/errors/OcpValidationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,WAAW,yBAAyB;IACxC,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,kBAAmB,SAAQ,QAAQ;IAC9C,iEAAiE;IACjE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,sDAAsD;IACtD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAE/B,yCAAyC;IACzC,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;gBAErB,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,yBAAyB;CAQpF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OcpValidationError = void 0;
|
|
4
|
+
const codes_1 = require("./codes");
|
|
5
|
+
const OcpError_1 = require("./OcpError");
|
|
6
|
+
/**
|
|
7
|
+
* Validation errors for invalid input data.
|
|
8
|
+
*
|
|
9
|
+
* Thrown when input data fails validation before being sent to DAML contracts.
|
|
10
|
+
* Includes the field path where validation failed and optionally the expected
|
|
11
|
+
* type and received value.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* if (!data.id) {
|
|
16
|
+
* throw new OcpValidationError('stakeholder.id', 'Required field is missing or empty', {
|
|
17
|
+
* expectedType: 'string',
|
|
18
|
+
* receivedValue: data.id,
|
|
19
|
+
* });
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example Catching validation errors
|
|
24
|
+
* ```typescript
|
|
25
|
+
* try {
|
|
26
|
+
* await ocp.OpenCapTable.capTable.update(...).create('stakeholder', data).execute();
|
|
27
|
+
* } catch (error) {
|
|
28
|
+
* if (error instanceof OcpValidationError) {
|
|
29
|
+
* console.error(`Validation failed at '${error.fieldPath}': ${error.message}`);
|
|
30
|
+
* console.error(`Expected: ${error.expectedType}, Got: ${error.receivedValue}`);
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
class OcpValidationError extends OcpError_1.OcpError {
|
|
36
|
+
constructor(fieldPath, message, options) {
|
|
37
|
+
const code = options?.code ?? codes_1.OcpErrorCodes.REQUIRED_FIELD_MISSING;
|
|
38
|
+
super(`Validation error at '${fieldPath}': ${message}`, code);
|
|
39
|
+
this.name = 'OcpValidationError';
|
|
40
|
+
this.fieldPath = fieldPath;
|
|
41
|
+
this.expectedType = options?.expectedType;
|
|
42
|
+
this.receivedValue = options?.receivedValue;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.OcpValidationError = OcpValidationError;
|
|
46
|
+
//# sourceMappingURL=OcpValidationError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OcpValidationError.js","sourceRoot":"","sources":["../../src/errors/OcpValidationError.ts"],"names":[],"mappings":";;;AAAA,mCAA2D;AAC3D,yCAAsC;AAWtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAa,kBAAmB,SAAQ,mBAAQ;IAU9C,YAAY,SAAiB,EAAE,OAAe,EAAE,OAAmC;QACjF,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,qBAAa,CAAC,sBAAsB,CAAC;QACnE,KAAK,CAAC,wBAAwB,SAAS,MAAM,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;QAC9D,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,YAAY,GAAG,OAAO,EAAE,YAAY,CAAC;QAC1C,IAAI,CAAC,aAAa,GAAG,OAAO,EAAE,aAAa,CAAC;IAC9C,CAAC;CACF;AAlBD,gDAkBC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error codes for OCP SDK errors.
|
|
3
|
+
*
|
|
4
|
+
* These codes allow programmatic handling of specific error conditions.
|
|
5
|
+
*/
|
|
6
|
+
export declare const OcpErrorCodes: {
|
|
7
|
+
readonly REQUIRED_FIELD_MISSING: "REQUIRED_FIELD_MISSING";
|
|
8
|
+
readonly INVALID_TYPE: "INVALID_TYPE";
|
|
9
|
+
readonly INVALID_FORMAT: "INVALID_FORMAT";
|
|
10
|
+
readonly OUT_OF_RANGE: "OUT_OF_RANGE";
|
|
11
|
+
readonly CONTRACT_NOT_FOUND: "CONTRACT_NOT_FOUND";
|
|
12
|
+
readonly CHOICE_FAILED: "CHOICE_FAILED";
|
|
13
|
+
readonly AUTHORIZATION_FAILED: "AUTHORIZATION_FAILED";
|
|
14
|
+
readonly RESULT_NOT_FOUND: "RESULT_NOT_FOUND";
|
|
15
|
+
readonly CONNECTION_FAILED: "CONNECTION_FAILED";
|
|
16
|
+
readonly TIMEOUT: "TIMEOUT";
|
|
17
|
+
readonly RATE_LIMITED: "RATE_LIMITED";
|
|
18
|
+
readonly INVALID_RESPONSE: "INVALID_RESPONSE";
|
|
19
|
+
readonly SCHEMA_MISMATCH: "SCHEMA_MISMATCH";
|
|
20
|
+
readonly UNKNOWN_ENUM_VALUE: "UNKNOWN_ENUM_VALUE";
|
|
21
|
+
};
|
|
22
|
+
export type OcpErrorCode = (typeof OcpErrorCodes)[keyof typeof OcpErrorCodes];
|
|
23
|
+
//# sourceMappingURL=codes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../src/errors/codes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;CAsBhB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OcpErrorCodes = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Error codes for OCP SDK errors.
|
|
6
|
+
*
|
|
7
|
+
* These codes allow programmatic handling of specific error conditions.
|
|
8
|
+
*/
|
|
9
|
+
exports.OcpErrorCodes = {
|
|
10
|
+
// Validation errors
|
|
11
|
+
REQUIRED_FIELD_MISSING: 'REQUIRED_FIELD_MISSING',
|
|
12
|
+
INVALID_TYPE: 'INVALID_TYPE',
|
|
13
|
+
INVALID_FORMAT: 'INVALID_FORMAT',
|
|
14
|
+
OUT_OF_RANGE: 'OUT_OF_RANGE',
|
|
15
|
+
// Contract errors
|
|
16
|
+
CONTRACT_NOT_FOUND: 'CONTRACT_NOT_FOUND',
|
|
17
|
+
CHOICE_FAILED: 'CHOICE_FAILED',
|
|
18
|
+
AUTHORIZATION_FAILED: 'AUTHORIZATION_FAILED',
|
|
19
|
+
RESULT_NOT_FOUND: 'RESULT_NOT_FOUND',
|
|
20
|
+
// Network errors
|
|
21
|
+
CONNECTION_FAILED: 'CONNECTION_FAILED',
|
|
22
|
+
TIMEOUT: 'TIMEOUT',
|
|
23
|
+
RATE_LIMITED: 'RATE_LIMITED',
|
|
24
|
+
// Parse errors
|
|
25
|
+
INVALID_RESPONSE: 'INVALID_RESPONSE',
|
|
26
|
+
SCHEMA_MISMATCH: 'SCHEMA_MISMATCH',
|
|
27
|
+
UNKNOWN_ENUM_VALUE: 'UNKNOWN_ENUM_VALUE',
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=codes.js.map
|