@kirimdev/sdk 1.0.1 → 2.0.1
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 +63 -63
- package/dist/client.d.ts +36 -9
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +43 -14
- package/dist/client.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/resources/contacts.d.ts +12 -5
- package/dist/resources/contacts.d.ts.map +1 -1
- package/dist/resources/contacts.js +24 -13
- package/dist/resources/contacts.js.map +1 -1
- package/dist/resources/conversations.d.ts +10 -3
- package/dist/resources/conversations.d.ts.map +1 -1
- package/dist/resources/conversations.js +19 -8
- package/dist/resources/conversations.js.map +1 -1
- package/dist/resources/messages.d.ts +43 -6
- package/dist/resources/messages.d.ts.map +1 -1
- package/dist/resources/messages.js +61 -10
- package/dist/resources/messages.js.map +1 -1
- package/dist/resources/phone-number.d.ts +38 -0
- package/dist/resources/phone-number.d.ts.map +1 -0
- package/dist/resources/phone-number.js +29 -0
- package/dist/resources/phone-number.js.map +1 -0
- package/dist/resources/templates.d.ts +8 -1
- package/dist/resources/templates.d.ts.map +1 -1
- package/dist/resources/templates.js +14 -3
- package/dist/resources/templates.js.map +1 -1
- package/dist/types.d.ts +30 -12
- package/dist/types.d.ts.map +1 -1
- package/openapi.json +6920 -6330
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
# @kirimdev/sdk
|
|
2
|
-
|
|
3
|
-
Official TypeScript SDK for the [Kirim](https://kirim.chat) Public API.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @kirimdev/sdk
|
|
9
|
-
# or
|
|
10
|
-
bun add @kirimdev/sdk
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Quickstart
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import { Kirim } from '@kirimdev/sdk'
|
|
17
|
-
|
|
18
|
-
const kirim = new Kirim({ apiKey: process.env.KIRIM_API_KEY! })
|
|
19
|
-
|
|
20
|
-
// Send a message
|
|
21
|
-
const msg = await kirim.messages.send({
|
|
22
|
-
to: '628123456789',
|
|
23
|
-
type: 'text',
|
|
24
|
-
text: { body: 'Halo dari SDK!' },
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
// Paginate
|
|
28
|
-
for await (const m of kirim.messages.list({ limit: 50 })) {
|
|
29
|
-
console.log(m.id, m.status)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Webhook verification
|
|
33
|
-
import { verifyWebhookSignature } from '@kirimdev/sdk/webhooks'
|
|
34
|
-
|
|
35
|
-
const ok = verifyWebhookSignature(rawBody, req.headers['x-kirim-signature'], secret)
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Features
|
|
39
|
-
|
|
40
|
-
- Full coverage of the Kirim `/v1` API (~35 endpoints)
|
|
41
|
-
- Type-safe — generated from the live OpenAPI 3.1 spec
|
|
42
|
-
- Automatic retries with exponential backoff (429, 5xx, network errors)
|
|
43
|
-
- Automatic `Idempotency-Key` injection for POST requests
|
|
44
|
-
- Async iterator pagination (`for await ... of kirim.messages.list(...)`)
|
|
45
|
-
- Typed error class hierarchy keyed off stable API error codes
|
|
46
|
-
- Webhook HMAC-SHA256 verifier
|
|
47
|
-
- Zero Node-specific dependencies — works in Node 18+, Bun, Deno
|
|
48
|
-
|
|
49
|
-
## Configuration
|
|
50
|
-
|
|
51
|
-
```ts
|
|
52
|
-
new Kirim({
|
|
53
|
-
apiKey: 'kdv_live_...', // required
|
|
54
|
-
baseUrl: 'https://api
|
|
55
|
-
timeout: 30_000, // ms, default 30s
|
|
56
|
-
maxRetries: 2, // default 2
|
|
57
|
-
fetch: globalThis.fetch, // injectable for testing
|
|
58
|
-
})
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## License
|
|
62
|
-
|
|
63
|
-
MIT
|
|
1
|
+
# @kirimdev/sdk
|
|
2
|
+
|
|
3
|
+
Official TypeScript SDK for the [Kirim](https://kirim.chat) Public API.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @kirimdev/sdk
|
|
9
|
+
# or
|
|
10
|
+
bun add @kirimdev/sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quickstart
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { Kirim } from '@kirimdev/sdk'
|
|
17
|
+
|
|
18
|
+
const kirim = new Kirim({ apiKey: process.env.KIRIM_API_KEY! })
|
|
19
|
+
|
|
20
|
+
// Send a message
|
|
21
|
+
const msg = await kirim.messages.send({
|
|
22
|
+
to: '628123456789',
|
|
23
|
+
type: 'text',
|
|
24
|
+
text: { body: 'Halo dari SDK!' },
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// Paginate
|
|
28
|
+
for await (const m of kirim.messages.list({ limit: 50 })) {
|
|
29
|
+
console.log(m.id, m.status)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Webhook verification
|
|
33
|
+
import { verifyWebhookSignature } from '@kirimdev/sdk/webhooks'
|
|
34
|
+
|
|
35
|
+
const ok = verifyWebhookSignature(rawBody, req.headers['x-kirim-signature'], secret)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- Full coverage of the Kirim `/v1` API (~35 endpoints)
|
|
41
|
+
- Type-safe — generated from the live OpenAPI 3.1 spec
|
|
42
|
+
- Automatic retries with exponential backoff (429, 5xx, network errors)
|
|
43
|
+
- Automatic `Idempotency-Key` injection for POST requests
|
|
44
|
+
- Async iterator pagination (`for await ... of kirim.messages.list(...)`)
|
|
45
|
+
- Typed error class hierarchy keyed off stable API error codes
|
|
46
|
+
- Webhook HMAC-SHA256 verifier
|
|
47
|
+
- Zero Node-specific dependencies — works in Node 18+, Bun, Deno
|
|
48
|
+
|
|
49
|
+
## Configuration
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
new Kirim({
|
|
53
|
+
apiKey: 'kdv_live_...', // required
|
|
54
|
+
baseUrl: 'https://api.kirim.chat/v1', // optional
|
|
55
|
+
timeout: 30_000, // ms, default 30s
|
|
56
|
+
maxRetries: 2, // default 2
|
|
57
|
+
fetch: globalThis.fetch, // injectable for testing
|
|
58
|
+
})
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
MIT
|
package/dist/client.d.ts
CHANGED
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Top-level `Kirim` client. Owns one `HttpClient` and exposes resource
|
|
3
3
|
* namespaces. Construction is cheap; one instance per API key per process.
|
|
4
|
+
*
|
|
5
|
+
* Public API surface (v2.x, Meta-style):
|
|
6
|
+
*
|
|
7
|
+
* - Org / team-level resources live on the root client:
|
|
8
|
+
* `kirim.accounts`, `kirim.labels`,
|
|
9
|
+
* `kirim.webhookSubscriptions`, `kirim.webhookDeliveries`
|
|
10
|
+
*
|
|
11
|
+
* - Per-WhatsApp-account resources hang off `phoneNumbers(id)`:
|
|
12
|
+
* `kirim.phoneNumbers(id).messages.send(...)`
|
|
13
|
+
* `kirim.phoneNumbers(id).conversations.list()`
|
|
14
|
+
* `kirim.phoneNumbers(id).contacts.create(...)`
|
|
15
|
+
* `kirim.phoneNumbers(id).templates.list()`
|
|
16
|
+
*
|
|
17
|
+
* `id` is Meta's `business_phone_number_id` — get it from
|
|
18
|
+
* `kirim.accounts.list()` (the `phone_number_id` field).
|
|
4
19
|
*/
|
|
5
20
|
import { type RequestOptions } from './http.js';
|
|
6
21
|
import { AccountsResource } from './resources/accounts.js';
|
|
7
|
-
import { ContactsResource } from './resources/contacts.js';
|
|
8
|
-
import { ConversationsResource } from './resources/conversations.js';
|
|
9
22
|
import { LabelsResource } from './resources/labels.js';
|
|
10
|
-
import {
|
|
11
|
-
import { TemplatesResource } from './resources/templates.js';
|
|
23
|
+
import { PhoneNumberClient } from './resources/phone-number.js';
|
|
12
24
|
import { WebhookDeliveriesResource } from './resources/webhook-deliveries.js';
|
|
13
25
|
import { WebhookSubscriptionsResource } from './resources/webhook-subscriptions.js';
|
|
14
26
|
import type { MeContext } from './types.js';
|
|
15
|
-
export declare const SDK_VERSION = "
|
|
27
|
+
export declare const SDK_VERSION = "2.0.0";
|
|
16
28
|
export interface KirimOptions {
|
|
17
29
|
/** Bearer API key. Format: `kdv_live_<...>`. Required. */
|
|
18
30
|
apiKey: string;
|
|
@@ -29,15 +41,30 @@ export interface KirimOptions {
|
|
|
29
41
|
}
|
|
30
42
|
export declare class Kirim {
|
|
31
43
|
readonly accounts: AccountsResource;
|
|
32
|
-
readonly messages: MessagesResource;
|
|
33
|
-
readonly templates: TemplatesResource;
|
|
34
|
-
readonly conversations: ConversationsResource;
|
|
35
|
-
readonly contacts: ContactsResource;
|
|
36
44
|
readonly labels: LabelsResource;
|
|
37
45
|
readonly webhookSubscriptions: WebhookSubscriptionsResource;
|
|
38
46
|
readonly webhookDeliveries: WebhookDeliveriesResource;
|
|
39
47
|
private readonly http;
|
|
40
48
|
constructor(options: KirimOptions);
|
|
49
|
+
/**
|
|
50
|
+
* Build a client scoped to a single WhatsApp account (Meta-style).
|
|
51
|
+
*
|
|
52
|
+
* @param phoneNumberId - Meta `business_phone_number_id`, digit-only
|
|
53
|
+
* string (e.g. `'106540352242922'`). Look up via
|
|
54
|
+
* `kirim.accounts.list()` if you don't have it handy.
|
|
55
|
+
*
|
|
56
|
+
* Cache the returned client at module top-level when you only operate
|
|
57
|
+
* on one account:
|
|
58
|
+
*
|
|
59
|
+
* ```ts
|
|
60
|
+
* const phone = kirim.phoneNumbers('106540352242922')
|
|
61
|
+
* await phone.messages.send({...})
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* Each call constructs a fresh client; instances are independent and
|
|
65
|
+
* safe to hold side-by-side for multi-number workflows.
|
|
66
|
+
*/
|
|
67
|
+
phoneNumbers(phoneNumberId: string): PhoneNumberClient;
|
|
41
68
|
/** GET /me — introspect the calling API key. */
|
|
42
69
|
me(options?: RequestOptions): Promise<MeContext>;
|
|
43
70
|
/**
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAiC,KAAK,cAAc,EAAE,MAAM,WAAW,CAAA;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAC7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAA;AACnF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,eAAO,MAAM,WAAW,UAAU,CAAA;AAKlC,MAAM,WAAW,YAAY;IAC3B,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAA;IACd,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;IACpB,wEAAwE;IACxE,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,qBAAa,KAAK;IAEhB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAA;IACnC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAA;IAC/B,QAAQ,CAAC,oBAAoB,EAAE,4BAA4B,CAAA;IAC3D,QAAQ,CAAC,iBAAiB,EAAE,yBAAyB,CAAA;IAErD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;gBAErB,OAAO,EAAE,YAAY;IA8BjC;;;;;;;;;;;;;;;;;OAiBG;IACH,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,iBAAiB;IAOtD,gDAAgD;IAChD,EAAE,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC;IAQhD;;;;OAIG;IACH,OAAO,CAAC,CAAC,GAAG,OAAO,EACjB,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,EAC3C,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE;QACL,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC,CAAA;QACpE,OAAO,CAAC,EAAE,cAAc,CAAA;KACzB,GACA,OAAO,CAAC,CAAC,CAAC;CASd"}
|
package/dist/client.js
CHANGED
|
@@ -1,26 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Top-level `Kirim` client. Owns one `HttpClient` and exposes resource
|
|
3
3
|
* namespaces. Construction is cheap; one instance per API key per process.
|
|
4
|
+
*
|
|
5
|
+
* Public API surface (v2.x, Meta-style):
|
|
6
|
+
*
|
|
7
|
+
* - Org / team-level resources live on the root client:
|
|
8
|
+
* `kirim.accounts`, `kirim.labels`,
|
|
9
|
+
* `kirim.webhookSubscriptions`, `kirim.webhookDeliveries`
|
|
10
|
+
*
|
|
11
|
+
* - Per-WhatsApp-account resources hang off `phoneNumbers(id)`:
|
|
12
|
+
* `kirim.phoneNumbers(id).messages.send(...)`
|
|
13
|
+
* `kirim.phoneNumbers(id).conversations.list()`
|
|
14
|
+
* `kirim.phoneNumbers(id).contacts.create(...)`
|
|
15
|
+
* `kirim.phoneNumbers(id).templates.list()`
|
|
16
|
+
*
|
|
17
|
+
* `id` is Meta's `business_phone_number_id` — get it from
|
|
18
|
+
* `kirim.accounts.list()` (the `phone_number_id` field).
|
|
4
19
|
*/
|
|
5
20
|
import { HttpClient } from './http.js';
|
|
6
21
|
import { AccountsResource } from './resources/accounts.js';
|
|
7
|
-
import { ContactsResource } from './resources/contacts.js';
|
|
8
|
-
import { ConversationsResource } from './resources/conversations.js';
|
|
9
22
|
import { LabelsResource } from './resources/labels.js';
|
|
10
|
-
import {
|
|
11
|
-
import { TemplatesResource } from './resources/templates.js';
|
|
23
|
+
import { PhoneNumberClient } from './resources/phone-number.js';
|
|
12
24
|
import { WebhookDeliveriesResource } from './resources/webhook-deliveries.js';
|
|
13
25
|
import { WebhookSubscriptionsResource } from './resources/webhook-subscriptions.js';
|
|
14
|
-
export const SDK_VERSION = '
|
|
15
|
-
const DEFAULT_BASE_URL = 'https://api
|
|
26
|
+
export const SDK_VERSION = '2.0.0';
|
|
27
|
+
const DEFAULT_BASE_URL = 'https://api.kirim.chat/v1';
|
|
16
28
|
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
17
29
|
const DEFAULT_MAX_RETRIES = 2;
|
|
18
30
|
export class Kirim {
|
|
31
|
+
// Org / team-scoped resources (sender selection not applicable).
|
|
19
32
|
accounts;
|
|
20
|
-
messages;
|
|
21
|
-
templates;
|
|
22
|
-
conversations;
|
|
23
|
-
contacts;
|
|
24
33
|
labels;
|
|
25
34
|
webhookSubscriptions;
|
|
26
35
|
webhookDeliveries;
|
|
@@ -44,14 +53,34 @@ export class Kirim {
|
|
|
44
53
|
};
|
|
45
54
|
this.http = new HttpClient(config);
|
|
46
55
|
this.accounts = new AccountsResource(this.http);
|
|
47
|
-
this.messages = new MessagesResource(this.http);
|
|
48
|
-
this.templates = new TemplatesResource(this.http);
|
|
49
|
-
this.conversations = new ConversationsResource(this.http);
|
|
50
|
-
this.contacts = new ContactsResource(this.http);
|
|
51
56
|
this.labels = new LabelsResource(this.http);
|
|
52
57
|
this.webhookSubscriptions = new WebhookSubscriptionsResource(this.http);
|
|
53
58
|
this.webhookDeliveries = new WebhookDeliveriesResource(this.http);
|
|
54
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Build a client scoped to a single WhatsApp account (Meta-style).
|
|
62
|
+
*
|
|
63
|
+
* @param phoneNumberId - Meta `business_phone_number_id`, digit-only
|
|
64
|
+
* string (e.g. `'106540352242922'`). Look up via
|
|
65
|
+
* `kirim.accounts.list()` if you don't have it handy.
|
|
66
|
+
*
|
|
67
|
+
* Cache the returned client at module top-level when you only operate
|
|
68
|
+
* on one account:
|
|
69
|
+
*
|
|
70
|
+
* ```ts
|
|
71
|
+
* const phone = kirim.phoneNumbers('106540352242922')
|
|
72
|
+
* await phone.messages.send({...})
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* Each call constructs a fresh client; instances are independent and
|
|
76
|
+
* safe to hold side-by-side for multi-number workflows.
|
|
77
|
+
*/
|
|
78
|
+
phoneNumbers(phoneNumberId) {
|
|
79
|
+
if (typeof phoneNumberId !== 'string' || phoneNumberId.length === 0) {
|
|
80
|
+
throw new TypeError('Kirim.phoneNumbers: `phoneNumberId` must be a non-empty string.');
|
|
81
|
+
}
|
|
82
|
+
return new PhoneNumberClient(this.http, phoneNumberId);
|
|
83
|
+
}
|
|
55
84
|
/** GET /me — introspect the calling API key. */
|
|
56
85
|
me(options) {
|
|
57
86
|
return this.http.requestData({
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE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KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACxD,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7C,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACpD,CAAC,CAAA;IACJ,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* tree-shakable when a consumer only needs the REST client.
|
|
6
6
|
*/
|
|
7
7
|
export { Kirim, SDK_VERSION, type KirimOptions } from './client.js';
|
|
8
|
+
export { PhoneNumberClient } from './resources/phone-number.js';
|
|
8
9
|
export type { Page, Paginator } from './pagination.js';
|
|
9
10
|
export type { RequestOptions } from './http.js';
|
|
10
11
|
export { KirimError, InvalidRequestError, AuthenticationError, PermissionError, NotFoundError, ConflictError, RateLimitError, ApiServerError, ConnectionError, type KirimErrorType, type KirimErrorPayload, } from './errors.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAE/D,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACtD,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE/C,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,SAAS,EACT,OAAO,EACP,kBAAkB,EAClB,OAAO,EACP,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,6BAA6B,EAC7B,OAAO,EACP,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,EACL,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,2BAA2B,EAC3B,+BAA+B,EAC/B,+BAA+B,EAC/B,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,2BAA2B,EAC3B,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -5,5 +5,6 @@
|
|
|
5
5
|
* tree-shakable when a consumer only needs the REST client.
|
|
6
6
|
*/
|
|
7
7
|
export { Kirim, SDK_VERSION } from './client.js';
|
|
8
|
+
export { PhoneNumberClient } from './resources/phone-number.js';
|
|
8
9
|
export { KirimError, InvalidRequestError, AuthenticationError, PermissionError, NotFoundError, ConflictError, RateLimitError, ApiServerError, ConnectionError, } from './errors.js';
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,KAAK,EAAE,WAAW,EAAqB,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,KAAK,EAAE,WAAW,EAAqB,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAK/D,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,eAAe,GAGhB,MAAM,aAAa,CAAA"}
|
|
@@ -1,32 +1,39 @@
|
|
|
1
1
|
import type { HttpClient, RequestOptions } from '../http.js';
|
|
2
2
|
import { Paginator } from '../pagination.js';
|
|
3
3
|
import type { AttachContactLabelParams, BulkLabelContactsParams, Contact, ContactListItem, CreateContactParams, ListContactsParams, UpdateContactParams } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Contacts resource — Meta-style path-scoped.
|
|
6
|
+
*
|
|
7
|
+
* Instantiated by {@link PhoneNumberClient}; the `prefix` is
|
|
8
|
+
* `/{phone_number_id}` (already URL-encoded by the parent).
|
|
9
|
+
*/
|
|
4
10
|
export declare class ContactsResource {
|
|
5
11
|
private readonly http;
|
|
6
|
-
|
|
12
|
+
private readonly prefix;
|
|
13
|
+
constructor(http: HttpClient, prefix: string);
|
|
7
14
|
create(params: CreateContactParams, options?: RequestOptions): Promise<Contact>;
|
|
8
15
|
list(params?: ListContactsParams, options?: RequestOptions): Paginator<ContactListItem>;
|
|
9
16
|
retrieve(id: string, options?: RequestOptions): Promise<Contact>;
|
|
10
17
|
update(id: string, params: UpdateContactParams, options?: RequestOptions): Promise<Contact>;
|
|
11
|
-
/** DELETE /contacts/{id} */
|
|
18
|
+
/** DELETE /{phone_number_id}/contacts/{id} */
|
|
12
19
|
del(id: string, options?: RequestOptions): Promise<{
|
|
13
20
|
id: string;
|
|
14
21
|
object: 'contact';
|
|
15
22
|
deleted: true;
|
|
16
23
|
}>;
|
|
17
|
-
/** POST /contacts/{id}/labels */
|
|
24
|
+
/** POST /{phone_number_id}/contacts/{id}/labels */
|
|
18
25
|
addLabel(contactId: string, params: AttachContactLabelParams, options?: RequestOptions): Promise<{
|
|
19
26
|
contact_id: string;
|
|
20
27
|
label_id: string;
|
|
21
28
|
attached: true;
|
|
22
29
|
}>;
|
|
23
|
-
/** DELETE /contacts/{id}/labels/{label_id} */
|
|
30
|
+
/** DELETE /{phone_number_id}/contacts/{id}/labels/{label_id} */
|
|
24
31
|
removeLabel(contactId: string, labelId: string, options?: RequestOptions): Promise<{
|
|
25
32
|
contact_id: string;
|
|
26
33
|
label_id: string;
|
|
27
34
|
attached: false;
|
|
28
35
|
}>;
|
|
29
|
-
/** POST /contacts/bulk_label */
|
|
36
|
+
/** POST /{phone_number_id}/contacts/bulk_label */
|
|
30
37
|
bulkLabel(params: BulkLabelContactsParams, options?: RequestOptions): Promise<{
|
|
31
38
|
applied: number;
|
|
32
39
|
skipped_cross_org: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contacts.d.ts","sourceRoot":"","sources":["../../src/resources/contacts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACvB,OAAO,EACP,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,aAAa,CAAA;AAEpB,qBAAa,gBAAgB;
|
|
1
|
+
{"version":3,"file":"contacts.d.ts","sourceRoot":"","sources":["../../src/resources/contacts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,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pE,gEAAgE;IAChE,WAAW,CACT,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,KAAK,CAAA;KAAE,CAAC;IAQrE,kDAAkD;IAClD,SAAS,CACP,MAAM,EAAE,uBAAuB,EAC/B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,MAAM,CAAC;QAAC,qBAAqB,EAAE,MAAM,CAAA;KAAE,CAAC;CAQ1F"}
|
|
@@ -1,65 +1,76 @@
|
|
|
1
1
|
import { Paginator } from '../pagination.js';
|
|
2
|
+
/**
|
|
3
|
+
* Contacts resource — Meta-style path-scoped.
|
|
4
|
+
*
|
|
5
|
+
* Instantiated by {@link PhoneNumberClient}; the `prefix` is
|
|
6
|
+
* `/{phone_number_id}` (already URL-encoded by the parent).
|
|
7
|
+
*/
|
|
2
8
|
export class ContactsResource {
|
|
3
9
|
http;
|
|
4
|
-
|
|
10
|
+
prefix;
|
|
11
|
+
constructor(http, prefix) {
|
|
5
12
|
this.http = http;
|
|
13
|
+
this.prefix = prefix;
|
|
6
14
|
}
|
|
7
15
|
create(params, options) {
|
|
8
16
|
return this.http.requestData({
|
|
9
17
|
method: 'POST',
|
|
10
|
-
path:
|
|
18
|
+
path: `${this.prefix}/contacts`,
|
|
11
19
|
body: params,
|
|
12
20
|
...(options ? { options } : {}),
|
|
13
21
|
});
|
|
14
22
|
}
|
|
15
23
|
list(params, options) {
|
|
16
|
-
return new Paginator(this.http, {
|
|
24
|
+
return new Paginator(this.http, {
|
|
25
|
+
path: `${this.prefix}/contacts`,
|
|
26
|
+
...(params ? { query: params } : {}),
|
|
27
|
+
}, options);
|
|
17
28
|
}
|
|
18
29
|
retrieve(id, options) {
|
|
19
30
|
return this.http.requestData({
|
|
20
31
|
method: 'GET',
|
|
21
|
-
path:
|
|
32
|
+
path: `${this.prefix}/contacts/${encodeURIComponent(id)}`,
|
|
22
33
|
...(options ? { options } : {}),
|
|
23
34
|
});
|
|
24
35
|
}
|
|
25
36
|
update(id, params, options) {
|
|
26
37
|
return this.http.requestData({
|
|
27
38
|
method: 'PATCH',
|
|
28
|
-
path:
|
|
39
|
+
path: `${this.prefix}/contacts/${encodeURIComponent(id)}`,
|
|
29
40
|
body: params,
|
|
30
41
|
...(options ? { options } : {}),
|
|
31
42
|
});
|
|
32
43
|
}
|
|
33
|
-
/** DELETE /contacts/{id} */
|
|
44
|
+
/** DELETE /{phone_number_id}/contacts/{id} */
|
|
34
45
|
del(id, options) {
|
|
35
46
|
return this.http.requestData({
|
|
36
47
|
method: 'DELETE',
|
|
37
|
-
path:
|
|
48
|
+
path: `${this.prefix}/contacts/${encodeURIComponent(id)}`,
|
|
38
49
|
...(options ? { options } : {}),
|
|
39
50
|
});
|
|
40
51
|
}
|
|
41
|
-
/** POST /contacts/{id}/labels */
|
|
52
|
+
/** POST /{phone_number_id}/contacts/{id}/labels */
|
|
42
53
|
addLabel(contactId, params, options) {
|
|
43
54
|
return this.http.requestData({
|
|
44
55
|
method: 'POST',
|
|
45
|
-
path:
|
|
56
|
+
path: `${this.prefix}/contacts/${encodeURIComponent(contactId)}/labels`,
|
|
46
57
|
body: params,
|
|
47
58
|
...(options ? { options } : {}),
|
|
48
59
|
});
|
|
49
60
|
}
|
|
50
|
-
/** DELETE /contacts/{id}/labels/{label_id} */
|
|
61
|
+
/** DELETE /{phone_number_id}/contacts/{id}/labels/{label_id} */
|
|
51
62
|
removeLabel(contactId, labelId, options) {
|
|
52
63
|
return this.http.requestData({
|
|
53
64
|
method: 'DELETE',
|
|
54
|
-
path:
|
|
65
|
+
path: `${this.prefix}/contacts/${encodeURIComponent(contactId)}/labels/${encodeURIComponent(labelId)}`,
|
|
55
66
|
...(options ? { options } : {}),
|
|
56
67
|
});
|
|
57
68
|
}
|
|
58
|
-
/** POST /contacts/bulk_label */
|
|
69
|
+
/** POST /{phone_number_id}/contacts/bulk_label */
|
|
59
70
|
bulkLabel(params, options) {
|
|
60
71
|
return this.http.requestData({
|
|
61
72
|
method: 'POST',
|
|
62
|
-
path:
|
|
73
|
+
path: `${this.prefix}/contacts/bulk_label`,
|
|
63
74
|
body: params,
|
|
64
75
|
...(options ? { options } : {}),
|
|
65
76
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../src/resources/contacts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAW5C,MAAM,OAAO,gBAAgB;
|
|
1
|
+
{"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../src/resources/contacts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAW5C;;;;;GAKG;AACH,MAAM,OAAO,gBAAgB;IAER;IACA;IAFnB,YACmB,IAAgB,EAChB,MAAc;QADd,SAAI,GAAJ,IAAI,CAAY;QAChB,WAAM,GAAN,MAAM,CAAQ;IAC9B,CAAC;IAEJ,MAAM,CAAC,MAA2B,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAU;YACpC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,WAAW;YAC/B,IAAI,EAAE,MAAM;YACZ,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChC,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,CAAC,MAA2B,EAAE,OAAwB;QACxD,OAAO,IAAI,SAAS,CAClB,IAAI,CAAC,IAAI,EACT;YACE,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,WAAW;YAC/B,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,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AE,GAAG,IAAI,CAAC,MAAM,aAAa,kBAAkB,CAAC,SAAS,CAAC,SAAS;YACvE,IAAI,EAAE,MAAM;YACZ,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChC,CAAC,CAAA;IACJ,CAAC;IAED,gEAAgE;IAChE,WAAW,CACT,SAAiB,EACjB,OAAe,EACf,OAAwB;QAExB,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;YAC3B,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,aAAa,kBAAkB,CAAC,SAAS,CAAC,WAAW,kBAAkB,CAAC,OAAO,CAAC,EAAE;YACtG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChC,CAAC,CAAA;IACJ,CAAC;IAED,kDAAkD;IAClD,SAAS,CACP,MAA+B,EAC/B,OAAwB;QAExB,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;YAC3B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,sBAAsB;YAC1C,IAAI,EAAE,MAAM;YACZ,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChC,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import type { HttpClient, RequestOptions } from '../http.js';
|
|
2
2
|
import { Paginator } from '../pagination.js';
|
|
3
3
|
import type { AttachConversationLabelParams, Conversation, ConversationListItem, ListConversationsParams, UpdateConversationParams } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Conversations resource — Meta-style path-scoped.
|
|
6
|
+
*
|
|
7
|
+
* Instantiated by {@link PhoneNumberClient}; the `prefix` is
|
|
8
|
+
* `/{phone_number_id}` (already URL-encoded by the parent).
|
|
9
|
+
*/
|
|
4
10
|
export declare class ConversationsResource {
|
|
5
11
|
private readonly http;
|
|
6
|
-
|
|
12
|
+
private readonly prefix;
|
|
13
|
+
constructor(http: HttpClient, prefix: string);
|
|
7
14
|
list(params?: ListConversationsParams, options?: RequestOptions): Paginator<ConversationListItem>;
|
|
8
15
|
retrieve(id: string, options?: RequestOptions): Promise<Conversation>;
|
|
9
16
|
update(id: string, params: UpdateConversationParams, options?: RequestOptions): Promise<Conversation>;
|
|
10
|
-
/** POST /conversations/{id}/labels */
|
|
17
|
+
/** POST /{phone_number_id}/conversations/{id}/labels */
|
|
11
18
|
addLabel(conversationId: string, params: AttachConversationLabelParams, options?: RequestOptions): Promise<{
|
|
12
19
|
conversation_id: string;
|
|
13
20
|
label_id: string;
|
|
14
21
|
attached: true;
|
|
15
22
|
}>;
|
|
16
|
-
/** DELETE /conversations/{id}/labels/{label_id} */
|
|
23
|
+
/** DELETE /{phone_number_id}/conversations/{id}/labels/{label_id} */
|
|
17
24
|
removeLabel(conversationId: string, labelId: string, options?: RequestOptions): Promise<{
|
|
18
25
|
conversation_id: string;
|
|
19
26
|
label_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/resources/conversations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,KAAK,EACV,6BAA6B,EAC7B,YAAY,EACZ,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,aAAa,CAAA;AAEpB,qBAAa,qBAAqB;
|
|
1
|
+
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/resources/conversations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC5D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|
+
*
|
|
5
|
+
* Instantiated by {@link PhoneNumberClient}; the `prefix` is
|
|
6
|
+
* `/{phone_number_id}` (already URL-encoded by the parent).
|
|
7
|
+
*/
|
|
2
8
|
export class ConversationsResource {
|
|
3
9
|
http;
|
|
4
|
-
|
|
10
|
+
prefix;
|
|
11
|
+
constructor(http, prefix) {
|
|
5
12
|
this.http = http;
|
|
13
|
+
this.prefix = prefix;
|
|
6
14
|
}
|
|
7
15
|
list(params, options) {
|
|
8
|
-
return new Paginator(this.http, {
|
|
16
|
+
return new Paginator(this.http, {
|
|
17
|
+
path: `${this.prefix}/conversations`,
|
|
18
|
+
...(params ? { query: params } : {}),
|
|
19
|
+
}, options);
|
|
9
20
|
}
|
|
10
21
|
retrieve(id, options) {
|
|
11
22
|
return this.http.requestData({
|
|
12
23
|
method: 'GET',
|
|
13
|
-
path:
|
|
24
|
+
path: `${this.prefix}/conversations/${encodeURIComponent(id)}`,
|
|
14
25
|
...(options ? { options } : {}),
|
|
15
26
|
});
|
|
16
27
|
}
|
|
17
28
|
update(id, params, options) {
|
|
18
29
|
return this.http.requestData({
|
|
19
30
|
method: 'PATCH',
|
|
20
|
-
path:
|
|
31
|
+
path: `${this.prefix}/conversations/${encodeURIComponent(id)}`,
|
|
21
32
|
body: params,
|
|
22
33
|
...(options ? { options } : {}),
|
|
23
34
|
});
|
|
24
35
|
}
|
|
25
|
-
/** POST /conversations/{id}/labels */
|
|
36
|
+
/** POST /{phone_number_id}/conversations/{id}/labels */
|
|
26
37
|
addLabel(conversationId, params, options) {
|
|
27
38
|
return this.http.requestData({
|
|
28
39
|
method: 'POST',
|
|
29
|
-
path:
|
|
40
|
+
path: `${this.prefix}/conversations/${encodeURIComponent(conversationId)}/labels`,
|
|
30
41
|
body: params,
|
|
31
42
|
...(options ? { options } : {}),
|
|
32
43
|
});
|
|
33
44
|
}
|
|
34
|
-
/** DELETE /conversations/{id}/labels/{label_id} */
|
|
45
|
+
/** DELETE /{phone_number_id}/conversations/{id}/labels/{label_id} */
|
|
35
46
|
removeLabel(conversationId, labelId, options) {
|
|
36
47
|
return this.http.requestData({
|
|
37
48
|
method: 'DELETE',
|
|
38
|
-
path:
|
|
49
|
+
path: `${this.prefix}/conversations/${encodeURIComponent(conversationId)}/labels/${encodeURIComponent(labelId)}`,
|
|
39
50
|
...(options ? { options } : {}),
|
|
40
51
|
});
|
|
41
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../src/resources/conversations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAS5C,MAAM,OAAO,qBAAqB;
|
|
1
|
+
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../src/resources/conversations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAS5C;;;;;GAKG;AACH,MAAM,OAAO,qBAAqB;IAEb;IACA;IAFnB,YACmB,IAAgB,EAChB,MAAc;QADd,SAAI,GAAJ,IAAI,CAAY;QAChB,WAAM,GAAN,MAAM,CAAQ;IAC9B,CAAC;IAEJ,IAAI,CACF,MAAgC,EAChC,OAAwB;QAExB,OAAO,IAAI,SAAS,CAClB,IAAI,CAAC,IAAI,EACT;YACE,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,gBAAgB;YACpC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAsE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACrG,EACD,OAAO,CACR,CAAA;IACH,CAAC;IAED,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAe;YACzC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,kBAAkB,kBAAkB,CAAC,EAAE,CAAC,EAAE;YAC9D,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,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