moss-partner-sdk 0.1.0 → 0.3.0
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/README.md +6 -6
- package/dist/__tests__/setup.d.ts +2 -13
- package/dist/__tests__/setup.d.ts.map +1 -1
- package/dist/__tests__/setup.js +3 -16
- package/dist/__tests__/setup.js.map +1 -1
- package/dist/account.d.ts +27 -0
- package/dist/account.d.ts.map +1 -0
- package/dist/account.js +24 -0
- package/dist/account.js.map +1 -0
- package/dist/analytics.d.ts +4 -15
- package/dist/analytics.d.ts.map +1 -1
- package/dist/analytics.js +1 -38
- package/dist/analytics.js.map +1 -1
- package/dist/billing.d.ts +13 -0
- package/dist/billing.d.ts.map +1 -0
- package/dist/billing.js +18 -0
- package/dist/billing.js.map +1 -0
- package/dist/client.d.ts +13 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +14 -14
- package/dist/client.js.map +1 -1
- package/dist/customers.d.ts +13 -11
- package/dist/customers.d.ts.map +1 -1
- package/dist/customers.js +123 -101
- package/dist/customers.js.map +1 -1
- package/dist/http.d.ts +3 -4
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +76 -91
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +16 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/dist/policies.d.ts +46 -0
- package/dist/policies.d.ts.map +1 -0
- package/dist/policies.js +40 -0
- package/dist/policies.js.map +1 -0
- package/dist/settings.d.ts +7 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +18 -0
- package/dist/settings.js.map +1 -0
- package/dist/tiers.d.ts +8 -0
- package/dist/tiers.d.ts.map +1 -0
- package/dist/tiers.js +17 -0
- package/dist/tiers.js.map +1 -0
- package/dist/types.d.ts +358 -129
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +8 -1
- package/dist/types.js.map +1 -1
- package/dist/usage.d.ts +50 -0
- package/dist/usage.d.ts.map +1 -0
- package/dist/usage.js +34 -0
- package/dist/usage.js.map +1 -0
- package/dist/webhooks.d.ts +6 -6
- package/dist/webhooks.d.ts.map +1 -1
- package/dist/webhooks.js +28 -14
- package/dist/webhooks.js.map +1 -1
- package/package.json +2 -2
- package/dist/utils/case.d.ts +0 -5
- package/dist/utils/case.d.ts.map +0 -1
- package/dist/utils/case.js +0 -47
- package/dist/utils/case.js.map +0 -1
package/README.md
CHANGED
|
@@ -13,13 +13,13 @@ To become a partner, visit [https://mosscomputing.com/partners](https://mosscomp
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
npm install
|
|
16
|
+
npm install moss-partner-sdk
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Quick Start
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
|
-
import { MossPartner } from '
|
|
22
|
+
import { MossPartner } from 'moss-partner-sdk';
|
|
23
23
|
|
|
24
24
|
const moss = new MossPartner({
|
|
25
25
|
apiKey: process.env.MOSS_PARTNER_KEY, // prt_xxx
|
|
@@ -114,7 +114,7 @@ const promoted = await moss.customers.promote('cust_aaa', {
|
|
|
114
114
|
kycCompleted: true,
|
|
115
115
|
termsAccepted: true,
|
|
116
116
|
complianceReviewed: true,
|
|
117
|
-
attestedBy: 'compliance@
|
|
117
|
+
attestedBy: 'compliance@yourcompany.com',
|
|
118
118
|
},
|
|
119
119
|
billing: {
|
|
120
120
|
tier: 'platform',
|
|
@@ -201,7 +201,7 @@ console.log(report.keyId); // Signing key ID
|
|
|
201
201
|
|
|
202
202
|
```typescript
|
|
203
203
|
const webhook = await moss.webhooks.create({
|
|
204
|
-
url: 'https://
|
|
204
|
+
url: 'https://yourcompany.com/webhooks/moss',
|
|
205
205
|
events: ['customer.*', 'agent.anomaly_detected', 'policy.violation'],
|
|
206
206
|
secret: 'whsec_xxx', // Optional, auto-generated if not provided
|
|
207
207
|
});
|
|
@@ -276,7 +276,7 @@ stream.close();
|
|
|
276
276
|
## Error Handling
|
|
277
277
|
|
|
278
278
|
```typescript
|
|
279
|
-
import { MossAPIError, MossNetworkError } from '
|
|
279
|
+
import { MossAPIError, MossNetworkError } from 'moss-partner-sdk';
|
|
280
280
|
|
|
281
281
|
try {
|
|
282
282
|
const customer = await moss.customers.get('cust_xxx');
|
|
@@ -329,7 +329,7 @@ const moss = new MossPartner({
|
|
|
329
329
|
The SDK is written in TypeScript and provides full type definitions:
|
|
330
330
|
|
|
331
331
|
```typescript
|
|
332
|
-
import type { Customer, Webhook, AnalyticsResponse } from '
|
|
332
|
+
import type { Customer, Webhook, AnalyticsResponse } from 'moss-partner-sdk';
|
|
333
333
|
|
|
334
334
|
const customer: Customer = await moss.customers.get('cust_xxx');
|
|
335
335
|
const webhooks: Webhook[] = await moss.webhooks.list();
|
|
@@ -7,27 +7,16 @@ export declare const skipIfNoApiKey: () => boolean;
|
|
|
7
7
|
export declare const fixtures: {
|
|
8
8
|
customer: {
|
|
9
9
|
create: (suffix?: string) => {
|
|
10
|
-
|
|
10
|
+
external_id: string;
|
|
11
11
|
name: string;
|
|
12
|
-
email: string;
|
|
13
|
-
governance: {
|
|
14
|
-
jurisdictions: string[];
|
|
15
|
-
frameworks: string[];
|
|
16
|
-
};
|
|
17
12
|
};
|
|
18
13
|
};
|
|
19
14
|
webhook: {
|
|
20
|
-
|
|
21
|
-
url: string;
|
|
22
|
-
events: string[];
|
|
23
|
-
secret: string;
|
|
24
|
-
};
|
|
15
|
+
secret: () => string;
|
|
25
16
|
};
|
|
26
17
|
};
|
|
27
18
|
export declare const cleanup: {
|
|
28
19
|
customers: string[];
|
|
29
|
-
webhooks: string[];
|
|
30
20
|
addCustomer(id: string): void;
|
|
31
|
-
addWebhook(id: string): void;
|
|
32
21
|
};
|
|
33
22
|
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/__tests__/setup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/__tests__/setup.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW;;;;CAIvB,CAAC;AAEF,eAAO,MAAM,cAAc,eAK1B,CAAC;AAQF,eAAO,MAAM,QAAQ;;0BAEA,MAAM;;;;;;;;CAQ1B,CAAC;AAEF,eAAO,MAAM,OAAO;eACD,MAAM,EAAE;oBAET,MAAM;CAGvB,CAAC"}
|
package/dist/__tests__/setup.js
CHANGED
|
@@ -16,37 +16,24 @@ const skipIfNoApiKey = () => {
|
|
|
16
16
|
exports.skipIfNoApiKey = skipIfNoApiKey;
|
|
17
17
|
(0, vitest_1.beforeAll)(() => {
|
|
18
18
|
if (!exports.TEST_CONFIG.partnerKey) {
|
|
19
|
-
console.warn('
|
|
19
|
+
console.warn('MOSS_PARTNER_KEY not set. Integration tests will be skipped.');
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
exports.fixtures = {
|
|
23
23
|
customer: {
|
|
24
24
|
create: (suffix = '001') => ({
|
|
25
|
-
|
|
25
|
+
external_id: `${exports.TEST_CONFIG.testPrefix}_${suffix}`,
|
|
26
26
|
name: `Test Corp ${suffix}`,
|
|
27
|
-
email: `test+${suffix}@example.com`,
|
|
28
|
-
governance: {
|
|
29
|
-
jurisdictions: ['US'],
|
|
30
|
-
frameworks: ['nist_ai_rmf'],
|
|
31
|
-
},
|
|
32
27
|
}),
|
|
33
28
|
},
|
|
34
29
|
webhook: {
|
|
35
|
-
|
|
36
|
-
url: 'https://example.com/webhooks/moss',
|
|
37
|
-
events: ['customer.*', 'agent.*'],
|
|
38
|
-
secret: 'whsec_test_' + Math.random().toString(36).substring(7),
|
|
39
|
-
}),
|
|
30
|
+
secret: () => 'whsec_test_' + Math.random().toString(36).substring(2, 15) + '_8chars',
|
|
40
31
|
},
|
|
41
32
|
};
|
|
42
33
|
exports.cleanup = {
|
|
43
34
|
customers: [],
|
|
44
|
-
webhooks: [],
|
|
45
35
|
addCustomer(id) {
|
|
46
36
|
this.customers.push(id);
|
|
47
37
|
},
|
|
48
|
-
addWebhook(id) {
|
|
49
|
-
this.webhooks.push(id);
|
|
50
|
-
},
|
|
51
38
|
};
|
|
52
39
|
//# sourceMappingURL=setup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/__tests__/setup.ts"],"names":[],"mappings":";;;AAIA,mCAAmC;
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/__tests__/setup.ts"],"names":[],"mappings":";;;AAIA,mCAAmC;AAEtB,QAAA,WAAW,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,+BAA+B;IACpE,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,EAAE;IAC9C,UAAU,EAAE,YAAY,IAAI,CAAC,GAAG,EAAE,EAAE;CACrC,CAAC;AAEK,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,IAAI,CAAC,mBAAW,CAAC,UAAU,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AALW,QAAA,cAAc,kBAKzB;AAEF,IAAA,kBAAS,EAAC,GAAG,EAAE;IACb,IAAI,CAAC,mBAAW,CAAC,UAAU,EAAE,CAAC;QAC5B,OAAO,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;IAC/E,CAAC;AACH,CAAC,CAAC,CAAC;AAEU,QAAA,QAAQ,GAAG;IACtB,QAAQ,EAAE;QACR,MAAM,EAAE,CAAC,SAAiB,KAAK,EAAE,EAAE,CAAC,CAAC;YACnC,WAAW,EAAE,GAAG,mBAAW,CAAC,UAAU,IAAI,MAAM,EAAE;YAClD,IAAI,EAAE,aAAa,MAAM,EAAE;SAC5B,CAAC;KACH;IACD,OAAO,EAAE;QACP,MAAM,EAAE,GAAG,EAAE,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,SAAS;KACtF;CACF,CAAC;AAEW,QAAA,OAAO,GAAG;IACrB,SAAS,EAAE,EAAc;IAEzB,WAAW,CAAC,EAAU;QACpB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { HTTPClient } from './http';
|
|
2
|
+
export interface PartnerDetails {
|
|
3
|
+
id: string;
|
|
4
|
+
external_id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
status: string;
|
|
7
|
+
settings: Record<string, unknown>;
|
|
8
|
+
created_at: string;
|
|
9
|
+
oem_mode?: boolean;
|
|
10
|
+
oem_config?: Record<string, unknown>;
|
|
11
|
+
governance: {
|
|
12
|
+
organizations: number;
|
|
13
|
+
agents: number;
|
|
14
|
+
envelopes: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface RotatedCredentials {
|
|
18
|
+
token: string;
|
|
19
|
+
credential_id: string;
|
|
20
|
+
}
|
|
21
|
+
export declare class AccountResource {
|
|
22
|
+
private http;
|
|
23
|
+
constructor(http: HTTPClient);
|
|
24
|
+
me(): Promise<PartnerDetails>;
|
|
25
|
+
rotateCredentials(): Promise<RotatedCredentials>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,UAAU,EAAE;QACV,aAAa,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,qBAAa,eAAe;IACd,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAM9B,EAAE,IAAI,OAAO,CAAC,cAAc,CAAC;IAgB7B,iBAAiB,IAAI,OAAO,CAAC,kBAAkB,CAAC;CAQvD"}
|
package/dist/account.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccountResource = void 0;
|
|
4
|
+
class AccountResource {
|
|
5
|
+
constructor(http) {
|
|
6
|
+
this.http = http;
|
|
7
|
+
}
|
|
8
|
+
async me() {
|
|
9
|
+
const response = await this.http.request({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/v1/partner/me',
|
|
12
|
+
});
|
|
13
|
+
return response.data;
|
|
14
|
+
}
|
|
15
|
+
async rotateCredentials() {
|
|
16
|
+
const response = await this.http.request({
|
|
17
|
+
method: 'POST',
|
|
18
|
+
path: '/v1/partner/credentials/rotate',
|
|
19
|
+
});
|
|
20
|
+
return response.data;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.AccountResource = AccountResource;
|
|
24
|
+
//# sourceMappingURL=account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":";;;AA+BA,MAAa,eAAe;IAC1B,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAMxC,KAAK,CAAC,EAAE;QACN,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAiB;YACvD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,gBAAgB;SACvB,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IASD,KAAK,CAAC,iBAAiB;QACrB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAqB;YAC3D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,gCAAgC;SACvC,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF;AA/BD,0CA+BC"}
|
package/dist/analytics.d.ts
CHANGED
|
@@ -1,23 +1,12 @@
|
|
|
1
1
|
import { HTTPClient } from './http';
|
|
2
|
-
import { AnalyticsResponse
|
|
2
|
+
import { AnalyticsResponse } from './types';
|
|
3
3
|
export interface AnalyticsParams {
|
|
4
|
-
period
|
|
5
|
-
granularity?:
|
|
6
|
-
[key: string]: string | undefined;
|
|
4
|
+
period?: string;
|
|
5
|
+
granularity?: string;
|
|
7
6
|
}
|
|
8
7
|
export declare class AnalyticsResource {
|
|
9
8
|
private http;
|
|
10
9
|
constructor(http: HTTPClient);
|
|
11
|
-
get(params
|
|
12
|
-
stream(): EventStream;
|
|
13
|
-
}
|
|
14
|
-
export declare class EventStream {
|
|
15
|
-
private handlers;
|
|
16
|
-
private ws;
|
|
17
|
-
constructor(_http: HTTPClient);
|
|
18
|
-
on(eventType: string, handler: (event: AnalyticsStreamEvent) => void): void;
|
|
19
|
-
off(eventType: string, handler: (event: AnalyticsStreamEvent) => void): void;
|
|
20
|
-
close(): void;
|
|
21
|
-
private connect;
|
|
10
|
+
get(params?: AnalyticsParams): Promise<AnalyticsResponse>;
|
|
22
11
|
}
|
|
23
12
|
//# sourceMappingURL=analytics.d.ts.map
|
package/dist/analytics.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,WAAW,eAAe;IAE9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,iBAAiB;IAChB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAQ9B,GAAG,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAShE"}
|
package/dist/analytics.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.AnalyticsResource = void 0;
|
|
4
4
|
class AnalyticsResource {
|
|
5
5
|
constructor(http) {
|
|
6
6
|
this.http = http;
|
|
@@ -13,43 +13,6 @@ class AnalyticsResource {
|
|
|
13
13
|
});
|
|
14
14
|
return response.data;
|
|
15
15
|
}
|
|
16
|
-
stream() {
|
|
17
|
-
return new EventStream(this.http);
|
|
18
|
-
}
|
|
19
16
|
}
|
|
20
17
|
exports.AnalyticsResource = AnalyticsResource;
|
|
21
|
-
class EventStream {
|
|
22
|
-
constructor(_http) {
|
|
23
|
-
this.handlers = new Map();
|
|
24
|
-
this.ws = null;
|
|
25
|
-
}
|
|
26
|
-
on(eventType, handler) {
|
|
27
|
-
if (!this.handlers.has(eventType)) {
|
|
28
|
-
this.handlers.set(eventType, []);
|
|
29
|
-
}
|
|
30
|
-
this.handlers.get(eventType).push(handler);
|
|
31
|
-
if (!this.ws) {
|
|
32
|
-
this.connect();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
off(eventType, handler) {
|
|
36
|
-
const handlers = this.handlers.get(eventType);
|
|
37
|
-
if (handlers) {
|
|
38
|
-
const index = handlers.indexOf(handler);
|
|
39
|
-
if (index !== -1) {
|
|
40
|
-
handlers.splice(index, 1);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
close() {
|
|
45
|
-
if (this.ws) {
|
|
46
|
-
this.ws.close();
|
|
47
|
-
this.ws = null;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
connect() {
|
|
51
|
-
console.warn('EventStream.connect() is not yet implemented');
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.EventStream = EventStream;
|
|
55
18
|
//# sourceMappingURL=analytics.js.map
|
package/dist/analytics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":";;;AAqBA,MAAa,iBAAiB;IAC5B,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAQxC,KAAK,CAAC,GAAG,CAAC,MAAwB;QAChC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAoB;YAC1D,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,uBAAuB;YAC7B,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF;AAlBD,8CAkBC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HTTPClient } from './http';
|
|
2
|
+
import { BillingEarnings } from './types';
|
|
3
|
+
export interface BillingParams {
|
|
4
|
+
period?: string;
|
|
5
|
+
start_date?: string;
|
|
6
|
+
end_date?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class BillingResource {
|
|
9
|
+
private http;
|
|
10
|
+
constructor(http: HTTPClient);
|
|
11
|
+
earnings(params?: BillingParams): Promise<BillingEarnings>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=billing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../src/billing.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,WAAW,aAAa;IAE5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,eAAe;IACd,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAU9B,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC;CASjE"}
|
package/dist/billing.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BillingResource = void 0;
|
|
4
|
+
class BillingResource {
|
|
5
|
+
constructor(http) {
|
|
6
|
+
this.http = http;
|
|
7
|
+
}
|
|
8
|
+
async earnings(params) {
|
|
9
|
+
const response = await this.http.request({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/v1/partner/billing/earnings',
|
|
12
|
+
query: params,
|
|
13
|
+
});
|
|
14
|
+
return response.data;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.BillingResource = BillingResource;
|
|
18
|
+
//# sourceMappingURL=billing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../src/billing.ts"],"names":[],"mappings":";;;AAkBA,MAAa,eAAe;IAC1B,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAUxC,KAAK,CAAC,QAAQ,CAAC,MAAsB;QACnC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAkB;YACxD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,8BAA8B;YACpC,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF;AApBD,0CAoBC"}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import { CustomersResource } from './customers';
|
|
2
2
|
import { WebhooksResource } from './webhooks';
|
|
3
3
|
import { AnalyticsResource } from './analytics';
|
|
4
|
-
import {
|
|
4
|
+
import { BillingResource } from './billing';
|
|
5
|
+
import { UsageResource } from './usage';
|
|
6
|
+
import { TiersResource } from './tiers';
|
|
7
|
+
import { PoliciesResource } from './policies';
|
|
8
|
+
import { SettingsResource } from './settings';
|
|
9
|
+
import { AccountResource } from './account';
|
|
10
|
+
import { MossPartnerConfig } from './types';
|
|
5
11
|
export declare class MossPartner {
|
|
6
12
|
private http;
|
|
7
13
|
readonly customers: CustomersResource;
|
|
8
14
|
readonly webhooks: WebhooksResource;
|
|
9
15
|
readonly analytics: AnalyticsResource;
|
|
16
|
+
readonly billing: BillingResource;
|
|
17
|
+
readonly usage: UsageResource;
|
|
18
|
+
readonly tiers: TiersResource;
|
|
19
|
+
readonly policies: PoliciesResource;
|
|
20
|
+
readonly settings: SettingsResource;
|
|
21
|
+
readonly account: AccountResource;
|
|
10
22
|
constructor(config: MossPartnerConfig);
|
|
11
|
-
introspectToken(request: TokenIntrospectionRequest): Promise<TokenIntrospectionResponse>;
|
|
12
|
-
asCustomer(_customerId: string): MossPartner;
|
|
13
23
|
ping(): Promise<boolean>;
|
|
14
24
|
}
|
|
15
25
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAyB5C,qBAAa,WAAW;IACtB,OAAO,CAAC,IAAI,CAAa;IAGzB,SAAgB,SAAS,EAAE,iBAAiB,CAAC;IAG7C,SAAgB,QAAQ,EAAE,gBAAgB,CAAC;IAG3C,SAAgB,SAAS,EAAE,iBAAiB,CAAC;IAG7C,SAAgB,OAAO,EAAE,eAAe,CAAC;IAGzC,SAAgB,KAAK,EAAE,aAAa,CAAC;IAGrC,SAAgB,KAAK,EAAE,aAAa,CAAC;IAGrC,SAAgB,QAAQ,EAAE,gBAAgB,CAAC;IAG3C,SAAgB,QAAQ,EAAE,gBAAgB,CAAC;IAG3C,SAAgB,OAAO,EAAE,eAAe,CAAC;gBAE7B,MAAM,EAAE,iBAAiB;IA0B/B,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;CAY/B"}
|
package/dist/client.js
CHANGED
|
@@ -5,30 +5,30 @@ const http_1 = require("./http");
|
|
|
5
5
|
const customers_1 = require("./customers");
|
|
6
6
|
const webhooks_1 = require("./webhooks");
|
|
7
7
|
const analytics_1 = require("./analytics");
|
|
8
|
+
const billing_1 = require("./billing");
|
|
9
|
+
const usage_1 = require("./usage");
|
|
10
|
+
const tiers_1 = require("./tiers");
|
|
11
|
+
const policies_1 = require("./policies");
|
|
12
|
+
const settings_1 = require("./settings");
|
|
13
|
+
const account_1 = require("./account");
|
|
8
14
|
class MossPartner {
|
|
9
15
|
constructor(config) {
|
|
10
16
|
if (!config.apiKey) {
|
|
11
17
|
throw new Error('apiKey is required');
|
|
12
18
|
}
|
|
13
|
-
if (!config.apiKey.startsWith('prt_')
|
|
19
|
+
if (!config.apiKey.startsWith('prt_')) {
|
|
14
20
|
throw new Error('apiKey must start with "prt_" (partner key)');
|
|
15
21
|
}
|
|
16
22
|
this.http = new http_1.HTTPClient(config);
|
|
17
23
|
this.customers = new customers_1.CustomersResource(this.http);
|
|
18
24
|
this.webhooks = new webhooks_1.WebhooksResource(this.http);
|
|
19
25
|
this.analytics = new analytics_1.AnalyticsResource(this.http);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
return response.data;
|
|
28
|
-
}
|
|
29
|
-
asCustomer(_customerId) {
|
|
30
|
-
throw new Error('asCustomer() is not yet implemented. ' +
|
|
31
|
-
'Use customer tokens directly or contact support for delegation features.');
|
|
26
|
+
this.billing = new billing_1.BillingResource(this.http);
|
|
27
|
+
this.usage = new usage_1.UsageResource(this.http);
|
|
28
|
+
this.tiers = new tiers_1.TiersResource(this.http);
|
|
29
|
+
this.policies = new policies_1.PoliciesResource(this.http);
|
|
30
|
+
this.settings = new settings_1.SettingsResource(this.http);
|
|
31
|
+
this.account = new account_1.AccountResource(this.http);
|
|
32
32
|
}
|
|
33
33
|
async ping() {
|
|
34
34
|
try {
|
|
@@ -38,7 +38,7 @@ class MossPartner {
|
|
|
38
38
|
});
|
|
39
39
|
return response.status === 200;
|
|
40
40
|
}
|
|
41
|
-
catch
|
|
41
|
+
catch {
|
|
42
42
|
return false;
|
|
43
43
|
}
|
|
44
44
|
}
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAMA,iCAAoC;AACpC,2CAAgD;AAChD,yCAA8C;AAC9C,2CAAgD;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAMA,iCAAoC;AACpC,2CAAgD;AAChD,yCAA8C;AAC9C,2CAAgD;AAChD,uCAA4C;AAC5C,mCAAwC;AACxC,mCAAwC;AACxC,yCAA8C;AAC9C,yCAA8C;AAC9C,uCAA4C;AA0B5C,MAAa,WAAW;IA8BtB,YAAY,MAAyB;QACnC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACxC,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;QAED,IAAI,CAAC,IAAI,GAAG,IAAI,iBAAU,CAAC,MAAM,CAAC,CAAC;QAEnC,IAAI,CAAC,SAAS,GAAG,IAAI,6BAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,CAAC,QAAQ,GAAG,IAAI,2BAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChD,IAAI,CAAC,SAAS,GAAG,IAAI,6BAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,CAAC,OAAO,GAAG,IAAI,yBAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,QAAQ,GAAG,IAAI,2BAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChD,IAAI,CAAC,QAAQ,GAAG,IAAI,2BAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChD,IAAI,CAAC,OAAO,GAAG,IAAI,yBAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAMD,KAAK,CAAC,IAAI;QACR,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;gBACvC,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,SAAS;aAChB,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAC;QACjC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AApED,kCAoEC"}
|
package/dist/customers.d.ts
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { HTTPClient } from './http';
|
|
2
|
-
import { Customer, CreateCustomerRequest, UpdateCustomerRequest, ListCustomersParams, ListCustomersResponse, PromoteCustomerRequest, SuspendCustomerRequest, ReactivateCustomerRequest,
|
|
2
|
+
import { Customer, CreateCustomerRequest, UpdateCustomerRequest, ListCustomersParams, ListCustomersResponse, PromoteCustomerRequest, SuspendCustomerRequest, ReactivateCustomerRequest, InviteCustomerRequest, InviteCustomerResponse, PromotionReadinessResponse, SessionResponse, ComplianceReportResponse, MGIResponse } from './types';
|
|
3
3
|
export declare class CustomersResource {
|
|
4
4
|
private http;
|
|
5
5
|
constructor(http: HTTPClient);
|
|
6
|
-
|
|
7
|
-
private mapSessionResponse;
|
|
8
|
-
private parsePdfSignatureTrailer;
|
|
9
|
-
create(request: CreateCustomerRequest): Promise<Customer>;
|
|
6
|
+
create(request: CreateCustomerRequest, idempotencyKey?: string): Promise<Customer>;
|
|
10
7
|
list(params?: ListCustomersParams): Promise<ListCustomersResponse>;
|
|
11
8
|
get(customerId: string): Promise<Customer>;
|
|
12
9
|
update(customerId: string, request: UpdateCustomerRequest): Promise<Customer>;
|
|
13
|
-
promote(customerId: string, request: PromoteCustomerRequest): Promise<Customer>;
|
|
14
|
-
suspend(customerId: string, request: SuspendCustomerRequest): Promise<Customer>;
|
|
15
|
-
reactivate(customerId: string, request: ReactivateCustomerRequest): Promise<Customer>;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
promote(customerId: string, request: PromoteCustomerRequest, idempotencyKey?: string): Promise<Customer>;
|
|
11
|
+
suspend(customerId: string, request: SuspendCustomerRequest, idempotencyKey?: string): Promise<Customer>;
|
|
12
|
+
reactivate(customerId: string, request: ReactivateCustomerRequest, idempotencyKey?: string): Promise<Customer>;
|
|
13
|
+
delete(customerId: string): Promise<Customer>;
|
|
14
|
+
createSession(customerId: string, idempotencyKey?: string): Promise<SessionResponse>;
|
|
15
|
+
revokeSession(customerId: string, sessionId?: string): Promise<void>;
|
|
16
|
+
invite(customerId: string, request: InviteCustomerRequest): Promise<InviteCustomerResponse>;
|
|
17
|
+
promotionReadiness(customerId: string): Promise<PromotionReadinessResponse>;
|
|
18
|
+
mgi(customerId: string): Promise<MGIResponse>;
|
|
19
|
+
complianceReport(customerId: string): Promise<ComplianceReportResponse>;
|
|
20
|
+
private parsePdfSignatureTrailer;
|
|
19
21
|
}
|
|
20
22
|
//# sourceMappingURL=customers.d.ts.map
|
package/dist/customers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../src/customers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../src/customers.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EACL,QAAQ,EACR,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,eAAe,EACf,wBAAwB,EACxB,WAAW,EAEZ,MAAM,SAAS,CAAC;AAEjB,qBAAa,iBAAiB;IAChB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAQ9B,MAAM,CACV,OAAO,EAAE,qBAAqB,EAC9B,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,QAAQ,CAAC;IAuBd,IAAI,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA2BlE,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAa1C,MAAM,CACV,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,QAAQ,CAAC;IAiBd,OAAO,CACX,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,sBAAsB,EAC/B,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,QAAQ,CAAC;IAsBd,OAAO,CACX,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,sBAAsB,EAC/B,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,QAAQ,CAAC;IAsBd,UAAU,CACd,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,yBAAyB,EAClC,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,QAAQ,CAAC;IAsBd,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAgB7C,aAAa,CACjB,UAAU,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,eAAe,CAAC;IAsBrB,aAAa,CACjB,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC;IAiBV,MAAM,CACV,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,sBAAsB,CAAC;IAc5B,kBAAkB,CACtB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,0BAA0B,CAAC;IAkBhC,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAiB7C,gBAAgB,CACpB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,wBAAwB,CAAC;IAapC,OAAO,CAAC,wBAAwB;CA+CjC"}
|