@chatarmin/os 1.14.0 → 1.15.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/dist/companies/client.d.ts.map +1 -1
- package/dist/companies/client.js +1 -0
- package/dist/companies/index.d.ts +1 -1
- package/dist/companies/index.d.ts.map +1 -1
- package/dist/companies/types.d.ts +56 -0
- package/dist/companies/types.d.ts.map +1 -1
- package/dist/index.d.ts +4 -90
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -66
- package/dist/links/client.d.ts +115 -0
- package/dist/links/client.d.ts.map +1 -0
- package/dist/links/client.js +84 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/companies/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,KAAK,EACV,eAAe,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/companies/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,KAAK,EACV,eAAe,EAgBhB,MAAM,YAAY,CAAA;AAEnB,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAA;AAC/D,KAAK,OAAO,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;AAE7E,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,OAAO,GACZ,eAAe,CA2CjB"}
|
package/dist/companies/client.js
CHANGED
|
@@ -6,6 +6,7 @@ export function createCompaniesClient(client, call) {
|
|
|
6
6
|
create: (input) => call('companies.create', () => client.companies.createWithLink.mutate(input)),
|
|
7
7
|
update: (input) => call('companies.update', () => client.companies.updateCompany.mutate(input)),
|
|
8
8
|
listLinks: (input) => call('companies.listLinks', () => client.companies.listProductLinks.query(input ?? {})),
|
|
9
|
+
listLinkMetadataFields: (input) => call('companies.listLinkMetadataFields', () => client.companies.listProductLinkMetadataFields.query(input ?? {})),
|
|
9
10
|
applyFreeOnboardTier: (input) => call('companies.applyFreeOnboardTier', () => client.companies.applyFreeOnboardTier.mutate(input)),
|
|
10
11
|
setupOnboardBilling: (input) => call('companies.setupOnboardBilling', () => client.companies.setupOnboardBilling.mutate(input)),
|
|
11
12
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { createCompaniesClient } from './client.js';
|
|
2
|
-
export type { CompaniesClient, CompanyAssignee, CompanyAssignees, CreateCompanyInput, CreateCompanyResult, GetCompanyInput, LinkedCompany, ListCompaniesInput, ListCompaniesResult, ListLinkedCompaniesInput, ListLinkedCompaniesResult, ProductCompany, ApplyFreeOnboardTierInput, ApplyFreeOnboardTierResult, SetupOnboardBillingInput, SetupOnboardBillingResult, UpdateCompanyResult, } from './types.js';
|
|
2
|
+
export type { CompaniesClient, CompanyAssignee, CompanyAssignees, CreateCompanyInput, CreateCompanyResult, GetCompanyInput, LinkedCompany, ListCompaniesInput, ListCompaniesResult, ListLinkedCompaniesInput, ListLinkedCompaniesResult, ProductCompany, ApplyFreeOnboardTierInput, ApplyFreeOnboardTierResult, SetupOnboardBillingInput, SetupOnboardBillingResult, UpdateCompanyResult, ListProductLinksInput, ListProductLinksResult, ProductLinkSummary, ProductLinkMetadataFilter, ProductLinkMetadataField, ListProductLinkMetadataFieldsInput, ListProductLinkMetadataFieldsResult, UpdateProductLinkInput, UpdateProductLinkResult, } from './types.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/companies/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACnD,YAAY,EACV,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,cAAc,EACd,yBAAyB,EACzB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/companies/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACnD,YAAY,EACV,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,cAAc,EACd,yBAAyB,EACzB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,wBAAwB,EACxB,kCAAkC,EAClC,mCAAmC,EACnC,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,YAAY,CAAA"}
|
|
@@ -59,13 +59,67 @@ export interface ProductLinkSummary {
|
|
|
59
59
|
externalUserId: string | null;
|
|
60
60
|
label: string | null;
|
|
61
61
|
status: string;
|
|
62
|
+
/** Product that owns the link, e.g. `chatarmin` or `cx`. */
|
|
63
|
+
productCode: string;
|
|
64
|
+
productName: string;
|
|
65
|
+
/** Metadata the owning product wrote with `links.update`; `{}` when none. */
|
|
66
|
+
metadata: Record<string, unknown>;
|
|
67
|
+
updatedAt: Date;
|
|
62
68
|
}
|
|
63
69
|
export interface ListProductLinksInput {
|
|
64
70
|
companyId?: string;
|
|
65
71
|
externalOrgId?: string;
|
|
72
|
+
/** Matches company name, domain, or external org id. */
|
|
73
|
+
query?: string;
|
|
74
|
+
/** List links of every product in your organization, not only your own. */
|
|
75
|
+
includeAllProducts?: boolean;
|
|
76
|
+
/** Only links of this product, e.g. `chatarmin`. */
|
|
77
|
+
productCode?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Up to 5 exact matches on link metadata, all of which must match. `path` is a dotted key
|
|
80
|
+
* (letters, digits, `_`, max 4 levels) as listed by `companies.listLinkMetadataFields`.
|
|
81
|
+
*/
|
|
82
|
+
metadataFilters?: ProductLinkMetadataFilter[];
|
|
66
83
|
limit?: number;
|
|
67
84
|
cursor?: string;
|
|
68
85
|
}
|
|
86
|
+
export interface ProductLinkMetadataFilter {
|
|
87
|
+
path: string;
|
|
88
|
+
equals: string | number | boolean | null;
|
|
89
|
+
}
|
|
90
|
+
export interface ListProductLinkMetadataFieldsInput {
|
|
91
|
+
includeAllProducts?: boolean;
|
|
92
|
+
productCode?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface ProductLinkMetadataField {
|
|
95
|
+
productCode: string;
|
|
96
|
+
/** Dotted path inside the link metadata, e.g. `whatsapp.coexistence`. */
|
|
97
|
+
path: string;
|
|
98
|
+
/** JSON types seen at this path: string, number, boolean, null, object, array. */
|
|
99
|
+
types: string[];
|
|
100
|
+
/** Links that carry this path. */
|
|
101
|
+
links: number;
|
|
102
|
+
}
|
|
103
|
+
export interface ListProductLinkMetadataFieldsResult {
|
|
104
|
+
fields: ProductLinkMetadataField[];
|
|
105
|
+
/** False when more than 500 paths exist and the list was cut. */
|
|
106
|
+
complete: boolean;
|
|
107
|
+
}
|
|
108
|
+
export interface UpdateProductLinkInput {
|
|
109
|
+
externalOrgId: string;
|
|
110
|
+
/**
|
|
111
|
+
* Shallow-merged into the link's product metadata (top-level keys replace, a key set to
|
|
112
|
+
* `null` stays `null`). Must be JSON, at most 32 KB, and never contain credentials: keys like
|
|
113
|
+
* `token`, `secret`, `password`, `pin` or `apiKey` are rejected.
|
|
114
|
+
*/
|
|
115
|
+
metadata: Record<string, unknown>;
|
|
116
|
+
/** Replace the link's product metadata with `metadata` instead of merging. */
|
|
117
|
+
resetMetadata?: boolean;
|
|
118
|
+
}
|
|
119
|
+
export interface UpdateProductLinkResult {
|
|
120
|
+
/** False when the stored metadata already matched. */
|
|
121
|
+
updated: boolean;
|
|
122
|
+
}
|
|
69
123
|
export interface ListProductLinksResult {
|
|
70
124
|
links: ProductLinkSummary[];
|
|
71
125
|
nextCursor?: string;
|
|
@@ -126,6 +180,8 @@ export interface CompaniesClient {
|
|
|
126
180
|
create: (input: CreateCompanyInput) => Promise<CreateCompanyResult>;
|
|
127
181
|
update: (input: UpdateCompanyInput) => Promise<UpdateCompanyResult>;
|
|
128
182
|
listLinks: (input?: ListProductLinksInput) => Promise<ListProductLinksResult>;
|
|
183
|
+
/** Metadata paths products wrote on links, with types and counts (never values). */
|
|
184
|
+
listLinkMetadataFields: (input?: ListProductLinkMetadataFieldsInput) => Promise<ListProductLinkMetadataFieldsResult>;
|
|
129
185
|
applyFreeOnboardTier: (input: ApplyFreeOnboardTierInput) => Promise<ApplyFreeOnboardTierResult>;
|
|
130
186
|
setupOnboardBilling: (input: SetupOnboardBillingInput) => Promise<SetupOnboardBillingResult>;
|
|
131
187
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/companies/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SA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@
|
|
|
1
1
|
import type { AppRouter } from "@chatarmin/api/trpc-types";
|
|
2
2
|
import { type CompaniesClient } from "./companies/index.js";
|
|
3
|
+
import { type LinksClient } from "./links/client.js";
|
|
4
|
+
export type { LinksClient } from "./links/client.js";
|
|
3
5
|
import { type ChannelsClient } from "./channels/index.js";
|
|
4
6
|
import { type BillingClient } from "./billing/index.js";
|
|
5
7
|
import { type DealsClient } from "./deals/index.js";
|
|
@@ -7,7 +9,7 @@ import { type FeaturesClient } from "./features/index.js";
|
|
|
7
9
|
import type { OnboardInput, OnboardResult } from "./onboard-types.js";
|
|
8
10
|
export { webhooks, constructProductWebhookEvent, generateTestWebhookHeaders, OsWebhookSignatureVerificationError, WEBHOOK_ID_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER, } from "./webhooks/index.js";
|
|
9
11
|
export type { ConstructProductWebhookEventOptions, ProductWebhookEventPayload, ProductWebhookHeaders, VerifiedProductWebhookEvent, } from "./webhooks/index.js";
|
|
10
|
-
export type { CompaniesClient, CompanyAssignee, CompanyAssignees, CreateCompanyInput, CreateCompanyResult, GetCompanyInput, LinkedCompany, ListCompaniesInput, ListCompaniesResult, ListLinkedCompaniesInput, ListLinkedCompaniesResult, ProductCompany, ApplyFreeOnboardTierInput, ApplyFreeOnboardTierResult, SetupOnboardBillingInput, SetupOnboardBillingResult, UpdateCompanyResult, } from "./companies/index.js";
|
|
12
|
+
export type { CompaniesClient, CompanyAssignee, CompanyAssignees, CreateCompanyInput, CreateCompanyResult, GetCompanyInput, LinkedCompany, ListCompaniesInput, ListCompaniesResult, ListLinkedCompaniesInput, ListLinkedCompaniesResult, ProductCompany, ApplyFreeOnboardTierInput, ApplyFreeOnboardTierResult, SetupOnboardBillingInput, SetupOnboardBillingResult, UpdateCompanyResult, ListProductLinksInput, ListProductLinksResult, ProductLinkSummary, ProductLinkMetadataFilter, ProductLinkMetadataField, ListProductLinkMetadataFieldsInput, ListProductLinkMetadataFieldsResult, UpdateProductLinkInput, UpdateProductLinkResult, } from "./companies/index.js";
|
|
11
13
|
export type { ChannelLinkType, ChannelsClient, LinkChannelInput, LinkChannelResult, LinkThreadInput, LinkThreadResult, UpdateChannelLinkInput, UpdateChannelLinkResult, } from "./channels/index.js";
|
|
12
14
|
export type * from "./deals/index.js";
|
|
13
15
|
export type { BillingClient, BillingInvoiceSummary, BillingOverview, BillingProfileSummary, BillingSubscriptionSummary, ClaimCheckoutInput, ClaimCheckoutResult, CreateBillingPortalSessionInput, EnsureFeatureSubscriptionInput, EnsureFeatureSubscriptionResult, GetBillingOverviewInput, GetUsageInput, LinkSubscriptionInput, LinkSubscriptionResult, ListBillingInvoicesOptions, PeriodOffsetRange, RelinkBillingProfileInput, ResolveInvoicePaymentUrlInput, SetUsageInput, SyncCompanyFromStripeInput, SyncCompanyFromStripeResult, UsageAggregate, UsageCycleBucket, UsageCycleSummary, UsagePoint, UsageQueryResult, UsageRecord, UsageSubscriptionItem, UsageResult, } from "./billing/index.js";
|
|
@@ -402,95 +404,7 @@ export declare class ChatarminOS {
|
|
|
402
404
|
* })
|
|
403
405
|
* ```
|
|
404
406
|
*/
|
|
405
|
-
get links():
|
|
406
|
-
/**
|
|
407
|
-
* Create a manual link between your external org ID and an existing company.
|
|
408
|
-
*
|
|
409
|
-
* Use this when you know the exact company ID and want to create
|
|
410
|
-
* a direct link without smart matching.
|
|
411
|
-
*
|
|
412
|
-
* @param input - Link parameters
|
|
413
|
-
* @param input.companyId - Company UUID or short_id (e.g., "acme-corp")
|
|
414
|
-
* @returns The created link record
|
|
415
|
-
*
|
|
416
|
-
* @example Using UUID
|
|
417
|
-
* ```typescript
|
|
418
|
-
* const link = await os.links.create({
|
|
419
|
-
* companyId: 'a1b2c3d4-e5f6-...',
|
|
420
|
-
* externalOrgId: 'org_abc123',
|
|
421
|
-
* label: 'Store Vienna'
|
|
422
|
-
* })
|
|
423
|
-
* ```
|
|
424
|
-
*
|
|
425
|
-
* @example Using short_id
|
|
426
|
-
* ```typescript
|
|
427
|
-
* const link = await os.links.create({
|
|
428
|
-
* companyId: 'acme-corp', // short_id works too!
|
|
429
|
-
* externalOrgId: 'org_abc123',
|
|
430
|
-
* label: 'Store Vienna'
|
|
431
|
-
* })
|
|
432
|
-
* ```
|
|
433
|
-
*/
|
|
434
|
-
create: (input: {
|
|
435
|
-
/** Company UUID or short_id */
|
|
436
|
-
companyId: string;
|
|
437
|
-
externalOrgId: string;
|
|
438
|
-
label?: string;
|
|
439
|
-
externalUserId?: string;
|
|
440
|
-
}) => Promise<{
|
|
441
|
-
id: string;
|
|
442
|
-
company_id: string | null;
|
|
443
|
-
status: string;
|
|
444
|
-
metadata: unknown;
|
|
445
|
-
created_at: Date;
|
|
446
|
-
updated_at: Date;
|
|
447
|
-
sync_status: string;
|
|
448
|
-
custom_fields: unknown;
|
|
449
|
-
label: string | null;
|
|
450
|
-
product_id: string;
|
|
451
|
-
external_org_id: string;
|
|
452
|
-
external_user_id: string | null;
|
|
453
|
-
confidence: number | null;
|
|
454
|
-
link_type: string;
|
|
455
|
-
external_display_name: string | null;
|
|
456
|
-
billing_profile_id: string | null;
|
|
457
|
-
}>;
|
|
458
|
-
/**
|
|
459
|
-
* Delete all product links for this product.
|
|
460
|
-
*
|
|
461
|
-
* Use this before re-importing to clean up old links.
|
|
462
|
-
* This only affects links for YOUR product (identified by API key).
|
|
463
|
-
*
|
|
464
|
-
* **Options:**
|
|
465
|
-
* - `deleteContacts`: Also delete contacts from linked companies
|
|
466
|
-
* - `resetMrr`: Also reset MRR to 0 for linked companies
|
|
467
|
-
*
|
|
468
|
-
* @returns Counts of deleted/reset items
|
|
469
|
-
*
|
|
470
|
-
* @example Basic reset (links only)
|
|
471
|
-
* ```typescript
|
|
472
|
-
* const result = await os.links.reset()
|
|
473
|
-
* console.log(`Deleted ${result.linksDeleted} links`)
|
|
474
|
-
* ```
|
|
475
|
-
*
|
|
476
|
-
* @example Full reset (links + contacts + MRR)
|
|
477
|
-
* ```typescript
|
|
478
|
-
* const result = await os.links.reset({
|
|
479
|
-
* deleteContacts: true,
|
|
480
|
-
* resetMrr: true
|
|
481
|
-
* })
|
|
482
|
-
* console.log(`Deleted ${result.linksDeleted} links, ${result.contactsDeleted} contacts`)
|
|
483
|
-
* ```
|
|
484
|
-
*/
|
|
485
|
-
reset: (options?: {
|
|
486
|
-
deleteContacts?: boolean;
|
|
487
|
-
resetMrr?: boolean;
|
|
488
|
-
}) => Promise<{
|
|
489
|
-
linksDeleted: number;
|
|
490
|
-
contactsDeleted: number;
|
|
491
|
-
companiesMrrReset: number;
|
|
492
|
-
}>;
|
|
493
|
-
};
|
|
407
|
+
get links(): LinksClient;
|
|
494
408
|
/**
|
|
495
409
|
* Subscription and tier management.
|
|
496
410
|
*
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAG1D,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAG/E,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAErE,OAAO,EACL,QAAQ,EACR,4BAA4B,EAC5B,0BAA0B,EAC1B,mCAAmC,EACnC,iBAAiB,EACjB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EACV,mCAAmC,EACnC,0BAA0B,EAC1B,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,qBAAqB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;;;;;;;;;;;;;;;;;;;OAiFG;IACG,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;CAS3D;AAGD,YAAY,EAAE,SAAS,EAAE,CAAA;AAGzB,eAAe,WAAW,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TRPCClientError, createTRPCClient, httpBatchLink } from "@trpc/client";
|
|
2
2
|
import superjson from "superjson";
|
|
3
3
|
import { createCompaniesClient, } from "./companies/index.js";
|
|
4
|
+
import { createLinksClient } from "./links/client.js";
|
|
4
5
|
import { createChannelsClient, } from "./channels/index.js";
|
|
5
6
|
import { createBillingClient } from "./billing/index.js";
|
|
6
7
|
import { createDealsClient } from "./deals/index.js";
|
|
@@ -374,72 +375,7 @@ export class ChatarminOS {
|
|
|
374
375
|
* ```
|
|
375
376
|
*/
|
|
376
377
|
get links() {
|
|
377
|
-
|
|
378
|
-
const call = this.call.bind(this);
|
|
379
|
-
return {
|
|
380
|
-
/**
|
|
381
|
-
* Create a manual link between your external org ID and an existing company.
|
|
382
|
-
*
|
|
383
|
-
* Use this when you know the exact company ID and want to create
|
|
384
|
-
* a direct link without smart matching.
|
|
385
|
-
*
|
|
386
|
-
* @param input - Link parameters
|
|
387
|
-
* @param input.companyId - Company UUID or short_id (e.g., "acme-corp")
|
|
388
|
-
* @returns The created link record
|
|
389
|
-
*
|
|
390
|
-
* @example Using UUID
|
|
391
|
-
* ```typescript
|
|
392
|
-
* const link = await os.links.create({
|
|
393
|
-
* companyId: 'a1b2c3d4-e5f6-...',
|
|
394
|
-
* externalOrgId: 'org_abc123',
|
|
395
|
-
* label: 'Store Vienna'
|
|
396
|
-
* })
|
|
397
|
-
* ```
|
|
398
|
-
*
|
|
399
|
-
* @example Using short_id
|
|
400
|
-
* ```typescript
|
|
401
|
-
* const link = await os.links.create({
|
|
402
|
-
* companyId: 'acme-corp', // short_id works too!
|
|
403
|
-
* externalOrgId: 'org_abc123',
|
|
404
|
-
* label: 'Store Vienna'
|
|
405
|
-
* })
|
|
406
|
-
* ```
|
|
407
|
-
*/
|
|
408
|
-
create: (input) => call("links.create", () => client.companies.upsertProductLink.mutate({
|
|
409
|
-
companyId: input.companyId,
|
|
410
|
-
externalOrgId: input.externalOrgId,
|
|
411
|
-
externalUserId: input.externalUserId,
|
|
412
|
-
label: input.label,
|
|
413
|
-
})),
|
|
414
|
-
/**
|
|
415
|
-
* Delete all product links for this product.
|
|
416
|
-
*
|
|
417
|
-
* Use this before re-importing to clean up old links.
|
|
418
|
-
* This only affects links for YOUR product (identified by API key).
|
|
419
|
-
*
|
|
420
|
-
* **Options:**
|
|
421
|
-
* - `deleteContacts`: Also delete contacts from linked companies
|
|
422
|
-
* - `resetMrr`: Also reset MRR to 0 for linked companies
|
|
423
|
-
*
|
|
424
|
-
* @returns Counts of deleted/reset items
|
|
425
|
-
*
|
|
426
|
-
* @example Basic reset (links only)
|
|
427
|
-
* ```typescript
|
|
428
|
-
* const result = await os.links.reset()
|
|
429
|
-
* console.log(`Deleted ${result.linksDeleted} links`)
|
|
430
|
-
* ```
|
|
431
|
-
*
|
|
432
|
-
* @example Full reset (links + contacts + MRR)
|
|
433
|
-
* ```typescript
|
|
434
|
-
* const result = await os.links.reset({
|
|
435
|
-
* deleteContacts: true,
|
|
436
|
-
* resetMrr: true
|
|
437
|
-
* })
|
|
438
|
-
* console.log(`Deleted ${result.linksDeleted} links, ${result.contactsDeleted} contacts`)
|
|
439
|
-
* ```
|
|
440
|
-
*/
|
|
441
|
-
reset: (options) => call("links.reset", () => client.companies.resetProductLinks.mutate(options)),
|
|
442
|
-
};
|
|
378
|
+
return createLinksClient(this.client, this.call.bind(this));
|
|
443
379
|
}
|
|
444
380
|
// ==========================================================================
|
|
445
381
|
// Subscriptions
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { AppRouter } from "@chatarmin/api/trpc-types";
|
|
2
|
+
import type { createTRPCClient } from "@trpc/client";
|
|
3
|
+
import type { UpdateProductLinkInput, UpdateProductLinkResult } from "../companies/types.js";
|
|
4
|
+
type SdkClient = ReturnType<typeof createTRPCClient<AppRouter>>;
|
|
5
|
+
type SdkCall = <T>(operation: string, action: () => Promise<T>) => Promise<T>;
|
|
6
|
+
/** Manual link operations; see `ChatarminOS.links`. */
|
|
7
|
+
export declare function createLinksClient(client: SdkClient, call: SdkCall): {
|
|
8
|
+
/**
|
|
9
|
+
* Create a manual link between your external org ID and an existing company.
|
|
10
|
+
*
|
|
11
|
+
* Use this when you know the exact company ID and want to create
|
|
12
|
+
* a direct link without smart matching.
|
|
13
|
+
*
|
|
14
|
+
* @param input - Link parameters
|
|
15
|
+
* @param input.companyId - Company UUID or short_id (e.g., "acme-corp")
|
|
16
|
+
* @returns The created link record
|
|
17
|
+
*
|
|
18
|
+
* @example Using UUID
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const link = await os.links.create({
|
|
21
|
+
* companyId: 'a1b2c3d4-e5f6-...',
|
|
22
|
+
* externalOrgId: 'org_abc123',
|
|
23
|
+
* label: 'Store Vienna'
|
|
24
|
+
* })
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example Using short_id
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const link = await os.links.create({
|
|
30
|
+
* companyId: 'acme-corp', // short_id works too!
|
|
31
|
+
* externalOrgId: 'org_abc123',
|
|
32
|
+
* label: 'Store Vienna'
|
|
33
|
+
* })
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
create: (input: {
|
|
37
|
+
/** Company UUID or short_id */
|
|
38
|
+
companyId: string;
|
|
39
|
+
externalOrgId: string;
|
|
40
|
+
label?: string;
|
|
41
|
+
externalUserId?: string;
|
|
42
|
+
}) => Promise<{
|
|
43
|
+
id: string;
|
|
44
|
+
company_id: string | null;
|
|
45
|
+
status: string;
|
|
46
|
+
metadata: unknown;
|
|
47
|
+
created_at: Date;
|
|
48
|
+
updated_at: Date;
|
|
49
|
+
sync_status: string;
|
|
50
|
+
custom_fields: unknown;
|
|
51
|
+
label: string | null;
|
|
52
|
+
product_id: string;
|
|
53
|
+
external_org_id: string;
|
|
54
|
+
external_user_id: string | null;
|
|
55
|
+
confidence: number | null;
|
|
56
|
+
link_type: string;
|
|
57
|
+
external_display_name: string | null;
|
|
58
|
+
billing_profile_id: string | null;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* Write your product's metadata on one of your links, e.g. channel ids other OS readers
|
|
62
|
+
* (staff tools, agents) should see next to the company.
|
|
63
|
+
*
|
|
64
|
+
* Merges top-level keys into the metadata you wrote before; pass `resetMetadata: true` to
|
|
65
|
+
* replace it. OS-owned link state is never touched. Credentials are rejected: never send
|
|
66
|
+
* tokens, secrets, passwords or PINs. Throws NOT_FOUND when the link does not exist.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* await os.links.update({
|
|
71
|
+
* externalOrgId: 'org_abc123',
|
|
72
|
+
* metadata: { whatsapp: { provider: 'meta', wabaId: '1029…', phoneNumberId: '3301…' } },
|
|
73
|
+
* })
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
update: (input: UpdateProductLinkInput) => Promise<UpdateProductLinkResult>;
|
|
77
|
+
/**
|
|
78
|
+
* Delete all product links for this product.
|
|
79
|
+
*
|
|
80
|
+
* Use this before re-importing to clean up old links.
|
|
81
|
+
* This only affects links for YOUR product (identified by API key).
|
|
82
|
+
*
|
|
83
|
+
* **Options:**
|
|
84
|
+
* - `deleteContacts`: Also delete contacts from linked companies
|
|
85
|
+
* - `resetMrr`: Also reset MRR to 0 for linked companies
|
|
86
|
+
*
|
|
87
|
+
* @returns Counts of deleted/reset items
|
|
88
|
+
*
|
|
89
|
+
* @example Basic reset (links only)
|
|
90
|
+
* ```typescript
|
|
91
|
+
* const result = await os.links.reset()
|
|
92
|
+
* console.log(`Deleted ${result.linksDeleted} links`)
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* @example Full reset (links + contacts + MRR)
|
|
96
|
+
* ```typescript
|
|
97
|
+
* const result = await os.links.reset({
|
|
98
|
+
* deleteContacts: true,
|
|
99
|
+
* resetMrr: true
|
|
100
|
+
* })
|
|
101
|
+
* console.log(`Deleted ${result.linksDeleted} links, ${result.contactsDeleted} contacts`)
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
reset: (options?: {
|
|
105
|
+
deleteContacts?: boolean;
|
|
106
|
+
resetMrr?: boolean;
|
|
107
|
+
}) => Promise<{
|
|
108
|
+
linksDeleted: number;
|
|
109
|
+
contactsDeleted: number;
|
|
110
|
+
companiesMrrReset: number;
|
|
111
|
+
}>;
|
|
112
|
+
};
|
|
113
|
+
export type LinksClient = ReturnType<typeof createLinksClient>;
|
|
114
|
+
export {};
|
|
115
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/links/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAE5F,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAA;AAC/D,KAAK,OAAO,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;AAE7E,uDAAuD;AACvD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO;IAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;oBACa;QACd,+BAA+B;QAC/B,SAAS,EAAE,MAAM,CAAA;QACjB,aAAa,EAAE,MAAM,CAAA;QACrB,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,cAAc,CAAC,EAAE,MAAM,CAAA;KACxB;;;;;;;;;;;;;;;;;;IAUD;;;;;;;;;;;;;;;OAeG;oBACa,sBAAsB,KAAG,OAAO,CAAC,uBAAuB,CAAC;IAKzE;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;sBACe;QAAE,cAAc,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE;;;;;EAKrE;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/** Manual link operations; see `ChatarminOS.links`. */
|
|
2
|
+
export function createLinksClient(client, call) {
|
|
3
|
+
return {
|
|
4
|
+
/**
|
|
5
|
+
* Create a manual link between your external org ID and an existing company.
|
|
6
|
+
*
|
|
7
|
+
* Use this when you know the exact company ID and want to create
|
|
8
|
+
* a direct link without smart matching.
|
|
9
|
+
*
|
|
10
|
+
* @param input - Link parameters
|
|
11
|
+
* @param input.companyId - Company UUID or short_id (e.g., "acme-corp")
|
|
12
|
+
* @returns The created link record
|
|
13
|
+
*
|
|
14
|
+
* @example Using UUID
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const link = await os.links.create({
|
|
17
|
+
* companyId: 'a1b2c3d4-e5f6-...',
|
|
18
|
+
* externalOrgId: 'org_abc123',
|
|
19
|
+
* label: 'Store Vienna'
|
|
20
|
+
* })
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example Using short_id
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const link = await os.links.create({
|
|
26
|
+
* companyId: 'acme-corp', // short_id works too!
|
|
27
|
+
* externalOrgId: 'org_abc123',
|
|
28
|
+
* label: 'Store Vienna'
|
|
29
|
+
* })
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
create: (input) => call("links.create", () => client.companies.upsertProductLink.mutate({
|
|
33
|
+
companyId: input.companyId,
|
|
34
|
+
externalOrgId: input.externalOrgId,
|
|
35
|
+
externalUserId: input.externalUserId,
|
|
36
|
+
label: input.label,
|
|
37
|
+
})),
|
|
38
|
+
/**
|
|
39
|
+
* Write your product's metadata on one of your links, e.g. channel ids other OS readers
|
|
40
|
+
* (staff tools, agents) should see next to the company.
|
|
41
|
+
*
|
|
42
|
+
* Merges top-level keys into the metadata you wrote before; pass `resetMetadata: true` to
|
|
43
|
+
* replace it. OS-owned link state is never touched. Credentials are rejected: never send
|
|
44
|
+
* tokens, secrets, passwords or PINs. Throws NOT_FOUND when the link does not exist.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* await os.links.update({
|
|
49
|
+
* externalOrgId: 'org_abc123',
|
|
50
|
+
* metadata: { whatsapp: { provider: 'meta', wabaId: '1029…', phoneNumberId: '3301…' } },
|
|
51
|
+
* })
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
update: (input) => call("links.update", () => client.companies.updateProductLinkMetadata.mutate(input)),
|
|
55
|
+
/**
|
|
56
|
+
* Delete all product links for this product.
|
|
57
|
+
*
|
|
58
|
+
* Use this before re-importing to clean up old links.
|
|
59
|
+
* This only affects links for YOUR product (identified by API key).
|
|
60
|
+
*
|
|
61
|
+
* **Options:**
|
|
62
|
+
* - `deleteContacts`: Also delete contacts from linked companies
|
|
63
|
+
* - `resetMrr`: Also reset MRR to 0 for linked companies
|
|
64
|
+
*
|
|
65
|
+
* @returns Counts of deleted/reset items
|
|
66
|
+
*
|
|
67
|
+
* @example Basic reset (links only)
|
|
68
|
+
* ```typescript
|
|
69
|
+
* const result = await os.links.reset()
|
|
70
|
+
* console.log(`Deleted ${result.linksDeleted} links`)
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @example Full reset (links + contacts + MRR)
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const result = await os.links.reset({
|
|
76
|
+
* deleteContacts: true,
|
|
77
|
+
* resetMrr: true
|
|
78
|
+
* })
|
|
79
|
+
* console.log(`Deleted ${result.linksDeleted} links, ${result.contactsDeleted} contacts`)
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
reset: (options) => call("links.reset", () => client.companies.resetProductLinks.mutate(options)),
|
|
83
|
+
};
|
|
84
|
+
}
|