@native-engagement/sdk 0.8.2 → 0.9.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/package.json CHANGED
@@ -1,23 +1,17 @@
1
1
  {
2
2
  "name": "@native-engagement/sdk",
3
- "version": "0.8.2",
3
+ "version": "0.9.1",
4
4
  "type": "module",
5
- "description": "Authenticated remote TypeScript client for Native Engagement",
6
5
  "engines": {
7
6
  "node": ">=24.22.1 <25"
8
7
  },
9
- "license": "UNLICENSED",
8
+ "license": "Apache-2.0",
10
9
  "files": [
11
10
  "dist",
12
- "README.md",
11
+ "LICENSE",
13
12
  "release.json",
14
13
  "THIRD_PARTY_LICENSES.txt"
15
14
  ],
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/SENLIN746/native-engagement.git"
19
- },
20
- "homepage": "https://engagement.shipkitx.com/downloads",
21
15
  "publishConfig": {
22
16
  "access": "public",
23
17
  "tag": "beta"
package/release.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "sourceCommit": "0270865d1f69c5c4c01d3acab37090346699763a",
3
+ "sourceCommit": "bc4ff2a04ed51d004904430cabe24b6a739f88e8",
4
4
  "channel": "beta",
5
5
  "bundledComponents": [
6
6
  {
@@ -14,5 +14,5 @@
14
14
  "license": "MIT"
15
15
  }
16
16
  ],
17
- "lockSha256": "6fed06159024d6c915e45acdd81734e0ec37fc25230cb6c1a9c00013d7a2ed66"
17
+ "lockSha256": "00164f8922c82350ad7cbe357f976d03b46faec9ebe48c634cb8ba2a922c3e3c"
18
18
  }
package/README.md DELETED
@@ -1,91 +0,0 @@
1
- # Native Engagement SDK
2
-
3
- JavaScript and TypeScript access to Native Engagement. Requires Node.js 24.22.1+ in the 24 LTS line.
4
-
5
- ```sh
6
- npm install @native-engagement/sdk@0.8.2
7
- ```
8
-
9
- ## Account and password sign-in
10
-
11
- The SDK supports browser-based account sign-in through OAuth Authorization Code with S256 PKCE. Enter your account, password and any MFA challenge on the identity service's browser page. The SDK receives a validated authorization result; your application does not collect the password.
12
-
13
- ```js
14
- import { createNativePublicLogin, openNativeLoginPage,
15
- RemoteNativeEngagementSdk, prospectClient } from '@native-engagement/sdk';
16
-
17
- const origin = 'https://engagement.shipkitx.com';
18
- const login = await createNativePublicLogin(origin);
19
- const grant = await login.authorize(AbortSignal.timeout(180_000), openNativeLoginPage);
20
- const sdk = new RemoteNativeEngagementSdk({ baseUrl: origin, accessToken: () => grant.accessToken });
21
- const prospects = prospectClient(sdk);
22
- ```
23
-
24
- `openNativeLoginPage` opens the system browser on macOS, Windows and Linux. Applications with their own browser UI can supply an `async authorizationUrl => { ... }` callback instead. The browser callback must reach the Node.js process on its configured loopback address. Use a local Node.js process for this flow; a browser-only application should use the service's web login.
25
-
26
- Public configuration comes from `/releases/cli-login.json` on the exact HTTPS center, with pinned issuer, public client, resource and business scopes. Your administrator must provision your account and tenant permissions. Current directory and Profile grants govern every operation.
27
-
28
- Keep the short-lived grant in memory or your protected credential store. Sign in again after expiry; an active identity-service browser session can reuse SSO. The SDK does not automatically persist credentials. Sign out with `await login.revoke(grant)`. For automation, supply a separately authorized access token through a token provider or protected process environment. Password arguments and password-grant login are not offered.
29
-
30
- ## Complete import, creation and association
31
-
32
- Country, industry, address, contact name/title and original score are optional `profile` strings. Source URLs are optional; supply the actual credential-free HTTP(S) source page when known. Source reference/version, observation time and current/historical status remain explicit. Persist and reuse the complete input and its idempotency key when retrying.
33
-
34
- ```js
35
- const observedAt = new Date().toISOString();
36
- const input = {
37
- idempotencyKey: 'research-november-v1', batchRef: 'research-november-v1', datasetRef: 'November research',
38
- rows: [{
39
- rowRef: 'row-1', sourceRef: 'reviewed-research-file', sourceVersion: 'v1',
40
- selection: 'SELECTED', displayName: 'Example Company',
41
- companyIdentity: { namespace: 'reviewed-company', value: 'company-001' },
42
- profile: { observedAt, temporalStatus: 'CURRENT', country: 'CN', industry: 'Logistics',
43
- address: 'Shanghai', contactName: 'Research Contact', contactTitle: 'Director', score: '8/10' },
44
- contacts: [{ channel: 'EMAIL', value: 'research@example.test', observation: {
45
- sourceRef: 'reviewed-research-file', sourceVersion: 'v1', observedAt,
46
- temporalStatus: 'CURRENT', verificationStatus: 'PUBLIC_UNVERIFIED'
47
- } }]
48
- }]
49
- };
50
- const preview = await prospects.preview(input); // No business write.
51
- console.log(preview.rows); // Review HELD/REJECTED outcomes before importing.
52
- await prospects.import(input);
53
- const batch = await prospects.batch(input.batchRef);
54
- const imported = batch.rows.find(row => row.status === 'IMPORTED');
55
- if (!imported?.prospectRef) throw Error('Review the import receipt');
56
- const company = await prospects.company(imported.prospectRef);
57
- console.log(company.profileObservations, company.contacts);
58
-
59
- const route = company.contacts.find(item => item.channel === 'EMAIL');
60
- const source = route?.observations.find(item => item.temporalStatus === 'CURRENT');
61
- if (!route || !source) throw Error('A current imported email observation is required');
62
- const create = {
63
- idempotencyKey: 'research-november-engagement-001', engagementRef: 'research-november-engagement-001',
64
- prospectRef: company.prospectRef, contactRouteRef: route.contactRouteRef,
65
- sourceRef: source.sourceRef, sourceVersion: source.sourceVersion, observedAt: source.observedAt,
66
- whyFit: 'Reviewed logistics fit', whyNow: 'Reviewed current opportunity'
67
- };
68
- await prospects.createEngagement(create);
69
- const associated = await prospects.engagements(company.prospectRef, { limit: 20 });
70
- console.log(associated.entries); // Continue with associated.nextCursor when present.
71
- ```
72
-
73
- Creation uses an exact imported CURRENT observation, current authorization and STOP policy. It records why-fit/why-now without sending or scheduling work. Changed source rows require a new version; names, emails and domains are not stable company identifiers. Score strings retain their original scale. Original research and verification belong to the archive/Knowledge owner; Native Engagement owns imported observations, provenance, receipts and engagement facts.
74
-
75
- ## Batch pagination
76
-
77
- Each response has at most 100 entries; total history has no 100-batch cap. Concurrent imports can shift offset pages; restart from the first page when refreshing. Associated engagements use a separate signed cursor.
78
-
79
- ```js
80
- let offset = 0;
81
- for (;;) {
82
- const page = await prospects.batches({ offset, limit: 20 });
83
- console.log(page.total, page.entries);
84
- if (page.nextOffset === null) break;
85
- offset = page.nextOffset;
86
- }
87
- ```
88
-
89
- Exports include `RemoteNativeEngagementSdk`, `RemoteNativeEngagementError`, `prospectClient`, `createNativePublicLogin`, `openNativeLoginPage`, `NativePublicLogin`, `NativeLoginConfiguration`, `NativeLoginGrant`, `RemoteSdkOptions` and Prospect DTOs. Generic `contracts`, `schema`, `query` and `command` remain available. Commands require a stable idempotency key. Unknown external effects require original-operation inspection.
90
-
91
- This beta uses license `UNLICENSED`. [Sign-in and MCP OAuth guide](https://engagement.shipkitx.com/releases/authentication.md) · [Downloads](https://engagement.shipkitx.com/downloads)