@chatarmin/os 1.14.0 → 1.16.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 +7 -0
- package/dist/companies/index.d.ts +2 -1
- package/dist/companies/index.d.ts.map +1 -1
- package/dist/companies/integrity-types.d.ts +190 -0
- package/dist/companies/integrity-types.d.ts.map +1 -0
- package/dist/companies/integrity-types.js +6 -0
- package/dist/companies/types.d.ts +98 -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,EAkBhB,MAAM,YAAY,CAAA;AAWnB,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,CA6EjB"}
|
package/dist/companies/client.js
CHANGED
|
@@ -6,7 +6,14 @@ 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)),
|
|
12
|
+
markCreditLineAttached: (input) => call('companies.markCreditLineAttached', () => client.companies.markCreditLineAttached.mutate(input)),
|
|
13
|
+
checkIntegrity: (input) => call('companies.checkIntegrity', () => client.companies.checkIntegrityForProduct.mutate(input)),
|
|
14
|
+
listIntegrityFindings: (input = {}) => call('companies.listIntegrityFindings', () => client.companies.listIntegrityFindingsForProduct.query(input)),
|
|
15
|
+
markIntegrityFindingsNotified: (input) => call('companies.markIntegrityFindingsNotified', () => client.companies.markIntegrityFindingsNotifiedForProduct.mutate(input)),
|
|
16
|
+
attachUsagePrice: (input) => call('companies.attachUsagePrice', () => client.companies.attachUsagePriceForStaff.mutate(input)),
|
|
17
|
+
linkProductOrg: (input) => call('companies.linkProductOrg', () => client.companies.linkProductOrgForStaff.mutate(input)),
|
|
11
18
|
};
|
|
12
19
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
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
|
+
export type { AttachUsagePriceInput, CheckIntegrityInput, CompanyIntegrityDeal, CompanyIntegrityResult, ContractSpec, ContractSpecSource, ContractUsagePrice, IntegrityFinding, IntegrityFindingCode, IntegrityFix, IntegritySeverity, LinkProductOrgInput, ListIntegrityFindingsInput, ListIntegrityFindingsResult, StaffFixResult, StoredIntegrityFinding, } from './integrity-types.js';
|
|
3
4
|
//# 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;AACnB,YAAY,EACV,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,0BAA0B,EAC1B,2BAA2B,EAC3B,cAAc,EACd,sBAAsB,GACvB,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Billing integrity: "from deal to invoice, is everything right for this client?"
|
|
3
|
+
* OS compares what the won deals sold (contract spec) with what OS has set up and bills, and
|
|
4
|
+
* returns typed findings, each with the fix that resolves it.
|
|
5
|
+
*/
|
|
6
|
+
export type IntegrityFindingCode = 'WON_DEAL_WITHOUT_COMPANY'
|
|
7
|
+
/** A won CRM deal never reached OS (organization-level: companyId is null). */
|
|
8
|
+
| 'WON_DEAL_NOT_IN_OS' | 'SPEC_INCOMPLETE' | 'SPEC_CONFLICT' | 'SOLD_PRODUCT_NOT_LINKED' | 'UNASSIGNED_LINK_CANDIDATE' | 'NO_BILLING_PROFILE' | 'NO_ACTIVE_SUBSCRIPTION' | 'USAGE_UNLINKED' | 'PRICE_MISSING_FOR_SPEC' | 'DEAL_PRICE_MISMATCH' | 'CREDIT_LINE_WITHOUT_META_PRICE' | 'META_PRICE_WITHOUT_CREDIT_LINE' | 'USAGE_EVENTS_STUCK' | 'SPLIT_SUBSCRIPTIONS_MERGEABLE';
|
|
9
|
+
export type IntegritySeverity = 'high' | 'medium' | 'low';
|
|
10
|
+
/** What resolves a finding: an OS primitive with its arguments, or a question for staff. */
|
|
11
|
+
export type IntegrityFix = {
|
|
12
|
+
kind: 'attach_usage_price';
|
|
13
|
+
productLinkId: string;
|
|
14
|
+
featureCode: string;
|
|
15
|
+
catalogPriceId: string;
|
|
16
|
+
/** Null when several subscriptions qualify; ask which one. */
|
|
17
|
+
subscriptionId: string | null;
|
|
18
|
+
/** The subscription must switch to flexible billing; confirm that explicitly. */
|
|
19
|
+
requiresFlexibleBilling: boolean;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'link_product_org';
|
|
22
|
+
productCode: string;
|
|
23
|
+
productLinkId: string | null;
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'create_catalog_price';
|
|
26
|
+
featureCode: string;
|
|
27
|
+
amountCents: number;
|
|
28
|
+
perUnits: number;
|
|
29
|
+
currency: string | null;
|
|
30
|
+
} | {
|
|
31
|
+
kind: 'merge_to_flexible';
|
|
32
|
+
subscriptionIds: string[];
|
|
33
|
+
} | {
|
|
34
|
+
kind: 'ask';
|
|
35
|
+
question: string;
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'manual';
|
|
38
|
+
instruction: string;
|
|
39
|
+
};
|
|
40
|
+
export interface IntegrityFinding {
|
|
41
|
+
code: IntegrityFindingCode;
|
|
42
|
+
severity: IntegritySeverity;
|
|
43
|
+
/** Stable while the problem persists. */
|
|
44
|
+
fingerprint: string;
|
|
45
|
+
message: string;
|
|
46
|
+
evidence: Record<string, string | number | boolean | null | string[]>;
|
|
47
|
+
fix: IntegrityFix;
|
|
48
|
+
}
|
|
49
|
+
export interface ContractSpecSource {
|
|
50
|
+
fieldKey: string;
|
|
51
|
+
fieldName: string | null;
|
|
52
|
+
rawValue: unknown;
|
|
53
|
+
}
|
|
54
|
+
export type ContractUsagePrice = {
|
|
55
|
+
featureCode: string;
|
|
56
|
+
productCode: string;
|
|
57
|
+
state: 'priced';
|
|
58
|
+
/** Minor units per `perUnits` units (e.g. 4000 per 1000 opt-ins). */
|
|
59
|
+
amountCents: number;
|
|
60
|
+
perUnits: number;
|
|
61
|
+
currency: string | null;
|
|
62
|
+
source: ContractSpecSource;
|
|
63
|
+
} | {
|
|
64
|
+
featureCode: string;
|
|
65
|
+
productCode: string;
|
|
66
|
+
state: 'zero' | 'missing' | 'not_sold';
|
|
67
|
+
source: ContractSpecSource | null;
|
|
68
|
+
};
|
|
69
|
+
export interface ContractSpec {
|
|
70
|
+
dealId: string;
|
|
71
|
+
products: string[];
|
|
72
|
+
paymentTerms: 'upfront' | 'yearly' | 'half_yearly' | 'quarterly' | 'monthly' | null;
|
|
73
|
+
contract: {
|
|
74
|
+
startAt: string | null;
|
|
75
|
+
endAt: string | null;
|
|
76
|
+
};
|
|
77
|
+
fixedMonthly: {
|
|
78
|
+
amountCents: number;
|
|
79
|
+
currency: string | null;
|
|
80
|
+
source: ContractSpecSource;
|
|
81
|
+
} | null;
|
|
82
|
+
setupFee: {
|
|
83
|
+
amountCents: number;
|
|
84
|
+
currency: string | null;
|
|
85
|
+
source: ContractSpecSource;
|
|
86
|
+
} | null;
|
|
87
|
+
usagePrices: ContractUsagePrice[];
|
|
88
|
+
freeText: Array<{
|
|
89
|
+
fieldKey: string;
|
|
90
|
+
fieldName: string | null;
|
|
91
|
+
text: string;
|
|
92
|
+
}>;
|
|
93
|
+
issues: Array<{
|
|
94
|
+
code: string;
|
|
95
|
+
message: string;
|
|
96
|
+
fieldKeys: string[];
|
|
97
|
+
}>;
|
|
98
|
+
}
|
|
99
|
+
export interface CompanyIntegrityDeal {
|
|
100
|
+
dealId: string;
|
|
101
|
+
title: string;
|
|
102
|
+
/** CRM provider and id, e.g. `pipedrive` + `3730`. */
|
|
103
|
+
provider: string;
|
|
104
|
+
externalId: string;
|
|
105
|
+
wonAt: Date | null;
|
|
106
|
+
/** Null on a dry run (`persist: false`). */
|
|
107
|
+
specId: string | null;
|
|
108
|
+
specStatus: 'extracted' | 'needs_review' | 'confirmed';
|
|
109
|
+
/** Advisory LLM reading of the deal's free-text fields. */
|
|
110
|
+
enrichment: {
|
|
111
|
+
notes: Array<{
|
|
112
|
+
topic: string;
|
|
113
|
+
statement: string;
|
|
114
|
+
}>;
|
|
115
|
+
contradictions: string[];
|
|
116
|
+
} | null;
|
|
117
|
+
}
|
|
118
|
+
export interface CheckIntegrityInput {
|
|
119
|
+
companyId?: string;
|
|
120
|
+
externalOrgId?: string;
|
|
121
|
+
/** false: evaluate without storing findings. Default true. */
|
|
122
|
+
persist?: boolean;
|
|
123
|
+
}
|
|
124
|
+
export interface CompanyIntegrityResult {
|
|
125
|
+
companyId: string;
|
|
126
|
+
checkedAt: string;
|
|
127
|
+
/** False when no active won deal could be read through a contract mapping. */
|
|
128
|
+
contractKnown: boolean;
|
|
129
|
+
spec: ContractSpec | null;
|
|
130
|
+
deals: CompanyIntegrityDeal[];
|
|
131
|
+
unmappedDealIds: string[];
|
|
132
|
+
/** Sorted high → low severity. */
|
|
133
|
+
findings: IntegrityFinding[];
|
|
134
|
+
persisted: boolean;
|
|
135
|
+
}
|
|
136
|
+
export interface ListIntegrityFindingsInput {
|
|
137
|
+
companyId?: string;
|
|
138
|
+
status?: 'open' | 'resolved';
|
|
139
|
+
severities?: IntegritySeverity[];
|
|
140
|
+
codes?: IntegrityFindingCode[];
|
|
141
|
+
/** Only findings no one was told about yet (for notification routines). */
|
|
142
|
+
unnotifiedOnly?: boolean;
|
|
143
|
+
cursor?: string;
|
|
144
|
+
limit?: number;
|
|
145
|
+
}
|
|
146
|
+
export interface StoredIntegrityFinding {
|
|
147
|
+
id: string;
|
|
148
|
+
/** Null for organization-level findings (WON_DEAL_NOT_IN_OS). */
|
|
149
|
+
companyId: string | null;
|
|
150
|
+
companyName: string | null;
|
|
151
|
+
fingerprint: string;
|
|
152
|
+
code: IntegrityFindingCode;
|
|
153
|
+
severity: IntegritySeverity;
|
|
154
|
+
message: string;
|
|
155
|
+
evidence: IntegrityFinding['evidence'];
|
|
156
|
+
fix: IntegrityFix;
|
|
157
|
+
status: 'open' | 'resolved';
|
|
158
|
+
firstSeenAt: Date;
|
|
159
|
+
lastSeenAt: Date;
|
|
160
|
+
resolvedAt: Date | null;
|
|
161
|
+
notifiedAt: Date | null;
|
|
162
|
+
}
|
|
163
|
+
export interface ListIntegrityFindingsResult {
|
|
164
|
+
findings: StoredIntegrityFinding[];
|
|
165
|
+
nextCursor: string | null;
|
|
166
|
+
}
|
|
167
|
+
export interface AttachUsagePriceInput {
|
|
168
|
+
companyId: string;
|
|
169
|
+
productLinkId: string;
|
|
170
|
+
featureCode: string;
|
|
171
|
+
catalogPriceId: string;
|
|
172
|
+
subscriptionId?: string;
|
|
173
|
+
/** Required true when the finding says requiresFlexibleBilling. Default false. */
|
|
174
|
+
allowFlexibleBillingSwitch?: boolean;
|
|
175
|
+
/** Login email of the OS member the fix is recorded for (403 otherwise). */
|
|
176
|
+
actorEmail: string;
|
|
177
|
+
}
|
|
178
|
+
export interface LinkProductOrgInput {
|
|
179
|
+
companyId: string;
|
|
180
|
+
productLinkId: string;
|
|
181
|
+
actorEmail: string;
|
|
182
|
+
}
|
|
183
|
+
export interface StaffFixResult {
|
|
184
|
+
applied: boolean;
|
|
185
|
+
action: string;
|
|
186
|
+
error: string | null;
|
|
187
|
+
/** The company re-checked after the fix. */
|
|
188
|
+
integrity: CompanyIntegrityResult;
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=integrity-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrity-types.d.ts","sourceRoot":"","sources":["../../src/companies/integrity-types.ts"],"names":[],"mappings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WAAW,2BAA2B;IAC1C,QAAQ,EAAE,sBAAsB,EAAE,CAAA;IAClC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,kFAAkF;IAClF,0BAA0B,CAAC,EAAE,OAAO,CAAA;IACpC,4EAA4E;IAC5E,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,4CAA4C;IAC5C,SAAS,EAAE,sBAAsB,CAAA;CAClC"}
|
|
@@ -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;
|
|
@@ -117,6 +171,26 @@ export interface SetupOnboardBillingResult {
|
|
|
117
171
|
subscriptionCreated: boolean;
|
|
118
172
|
assignedProductLinkIds: string[];
|
|
119
173
|
}
|
|
174
|
+
export interface MarkCreditLineAttachedInput {
|
|
175
|
+
externalOrgId: string;
|
|
176
|
+
attached?: boolean;
|
|
177
|
+
attachedAt?: string;
|
|
178
|
+
}
|
|
179
|
+
export interface MarkCreditLineAttachedResult {
|
|
180
|
+
companyId: string;
|
|
181
|
+
productLinkId: string;
|
|
182
|
+
externalOrgId: string;
|
|
183
|
+
creditLineAttached: boolean;
|
|
184
|
+
creditLineAttachedAt: string | null;
|
|
185
|
+
subscriptions: Array<{
|
|
186
|
+
featureCode: string;
|
|
187
|
+
success: boolean;
|
|
188
|
+
action?: string;
|
|
189
|
+
subscriptionItemId?: string | null;
|
|
190
|
+
error?: string;
|
|
191
|
+
}>;
|
|
192
|
+
}
|
|
193
|
+
import type { AttachUsagePriceInput, CheckIntegrityInput, CompanyIntegrityResult, LinkProductOrgInput, ListIntegrityFindingsInput, ListIntegrityFindingsResult, StaffFixResult } from './integrity-types.js';
|
|
120
194
|
export interface CompaniesClient {
|
|
121
195
|
get: (input: GetCompanyInput) => Promise<ProductCompany | null>;
|
|
122
196
|
list: (input?: ListCompaniesInput) => Promise<ListCompaniesResult>;
|
|
@@ -126,7 +200,31 @@ export interface CompaniesClient {
|
|
|
126
200
|
create: (input: CreateCompanyInput) => Promise<CreateCompanyResult>;
|
|
127
201
|
update: (input: UpdateCompanyInput) => Promise<UpdateCompanyResult>;
|
|
128
202
|
listLinks: (input?: ListProductLinksInput) => Promise<ListProductLinksResult>;
|
|
203
|
+
/** Metadata paths products wrote on links, with types and counts (never values). */
|
|
204
|
+
listLinkMetadataFields: (input?: ListProductLinkMetadataFieldsInput) => Promise<ListProductLinkMetadataFieldsResult>;
|
|
129
205
|
applyFreeOnboardTier: (input: ApplyFreeOnboardTierInput) => Promise<ApplyFreeOnboardTierResult>;
|
|
130
206
|
setupOnboardBilling: (input: SetupOnboardBillingInput) => Promise<SetupOnboardBillingResult>;
|
|
207
|
+
markCreditLineAttached: (input: MarkCreditLineAttachedInput) => Promise<MarkCreditLineAttachedResult>;
|
|
208
|
+
/**
|
|
209
|
+
* From deal to invoice, is everything right for this client? Compares what the won deals
|
|
210
|
+
* sold with what OS has set up and bills; stores and returns typed findings with their fix.
|
|
211
|
+
* Reads span every product of your organization.
|
|
212
|
+
*/
|
|
213
|
+
checkIntegrity: (input: CheckIntegrityInput) => Promise<CompanyIntegrityResult>;
|
|
214
|
+
/** Stored findings across the organization's companies (cursor pagination). */
|
|
215
|
+
listIntegrityFindings: (input?: ListIntegrityFindingsInput) => Promise<ListIntegrityFindingsResult>;
|
|
216
|
+
/** Marks findings as told to staff, so notification routines post each once. */
|
|
217
|
+
markIntegrityFindingsNotified: (input: {
|
|
218
|
+
findingIds: string[];
|
|
219
|
+
}) => Promise<{
|
|
220
|
+
updated: number;
|
|
221
|
+
}>;
|
|
222
|
+
/**
|
|
223
|
+
* Staff fix: adds a related usage price to the company's subscription and links the
|
|
224
|
+
* feature, for any product link of the company. Recorded for `actorEmail` (an OS member).
|
|
225
|
+
*/
|
|
226
|
+
attachUsagePrice: (input: AttachUsagePriceInput) => Promise<StaffFixResult>;
|
|
227
|
+
/** Staff fix: links an unassigned product org to the company. Recorded for `actorEmail`. */
|
|
228
|
+
linkProductOrg: (input: LinkProductOrgInput) => Promise<StaffFixResult>;
|
|
131
229
|
}
|
|
132
230
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/companies/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW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A6B,EAAE,CAAC,KAAK,EAAE;QAAE,UAAU,EAAE,MAAM,EAAE,CAAA;KAAE,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAChG;;;OAGG;IACH,gBAAgB,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAA;IAC3E,4FAA4F;IAC5F,cAAc,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAA;CACxE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
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, AttachUsagePriceInput, CheckIntegrityInput, CompanyIntegrityDeal, CompanyIntegrityResult, ContractSpec, ContractSpecSource, ContractUsagePrice, IntegrityFinding, IntegrityFindingCode, IntegrityFix, IntegritySeverity, LinkProductOrgInput, ListIntegrityFindingsInput, ListIntegrityFindingsResult, StaffFixResult, StoredIntegrityFinding, } 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;AAG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OAAO,IAAI,aAAa,CAE3B;IAED,4EAA4E;IAC5E,IAAI,KAAK,IAAI,WAAW,CAEvB;IAMD;;;;;;;;;;;;;;;OAeG;IACH,IAAI,KAAK,IAAI,WAAW,CAEvB;IAMD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,aAAa;QAIb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA6BG;2BACgB,MAAM,WAAW,cAAc;;;;;QASlD;;;;;;;;;;;;;;;;;;;WAmBG;;;;;;;;;;;;;;;;;;;;QAMH;;;;;;;;;;;;;;;;;;;;;;;WAuBG;4BACiB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAK7B;IAMD;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,IAAI,KAAK;QAIL;;;;;;;;;;;WAWG;;;;;;;;;;;;;;;;;;;;QAMH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAsCG;wBACa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAKtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA8BG;0BACe,MAAM,WAAW,cAAc;;;;;MASpD;IAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
|
+
}
|