@tenonhq/dovetail-servicenow 0.0.9 → 0.0.10
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/client.d.ts +14 -14
- package/dist/client.js +26 -25
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
* - `buildAgent.*` — reads via the sn_build_agent API, with graceful
|
|
7
7
|
* fallback to Table API / sys_dictionary when the
|
|
8
8
|
* Build Agent plugin is unavailable
|
|
9
|
-
* - `claude.*` — writes via the Dovetail Scripted REST API
|
|
10
|
-
* (/api/cadso/
|
|
11
|
-
* switching atomically so every write lands in the
|
|
12
|
-
* update set without touching sys_user_preference.
|
|
13
|
-
* Falls back to the legacy /api/cadso/
|
|
14
|
-
* instances
|
|
15
|
-
* The
|
|
16
|
-
* compatibility; the
|
|
17
|
-
*
|
|
9
|
+
* - `claude.*` — writes via the Dovetail core Scripted REST API
|
|
10
|
+
* (/api/cadso/dovetail_core/*), which handles update-set +
|
|
11
|
+
* scope switching atomically so every write lands in the
|
|
12
|
+
* right update set without touching sys_user_preference.
|
|
13
|
+
* Falls back to the legacy global-scope /api/cadso/dovetail/*
|
|
14
|
+
* path on instances without the Dovetail app installed.
|
|
15
|
+
* The `claude.*` property name is preserved for API
|
|
16
|
+
* compatibility; the server-side API now lives in the
|
|
17
|
+
* Dovetail scoped application as "Dovetail Core".
|
|
18
18
|
*
|
|
19
19
|
* Env fallbacks mirror prior dashboard-fetch helpers so dev setups that already
|
|
20
20
|
* have SN_INSTANCE/SN_USER/SN_PASSWORD work without reconfiguration.
|
|
@@ -62,7 +62,7 @@ export interface ServiceNowClient {
|
|
|
62
62
|
getTableSchema: (table: string) => Promise<TableSchema>;
|
|
63
63
|
};
|
|
64
64
|
claude: {
|
|
65
|
-
/** POST /api/cadso/
|
|
65
|
+
/** POST /api/cadso/dovetail_core/createRecord (legacy: /api/cadso/dovetail/createRecord). */
|
|
66
66
|
createRecord: (params: {
|
|
67
67
|
table: string;
|
|
68
68
|
fields: Record<string, any>;
|
|
@@ -73,7 +73,7 @@ export interface ServiceNowClient {
|
|
|
73
73
|
sys_id: string;
|
|
74
74
|
[k: string]: any;
|
|
75
75
|
}>;
|
|
76
|
-
/** POST /api/cadso/
|
|
76
|
+
/** POST /api/cadso/dovetail_core/pushWithUpdateSet (legacy: /api/cadso/dovetail/pushWithUpdateSet). */
|
|
77
77
|
pushWithUpdateSet: (params: {
|
|
78
78
|
update_set_sys_id: string;
|
|
79
79
|
table: string;
|
|
@@ -83,18 +83,18 @@ export interface ServiceNowClient {
|
|
|
83
83
|
sys_id: string;
|
|
84
84
|
[k: string]: any;
|
|
85
85
|
}>;
|
|
86
|
-
/** GET /api/cadso/
|
|
86
|
+
/** GET /api/cadso/dovetail_core/currentUpdateSet?scope=... (legacy: /api/cadso/dovetail/currentUpdateSet). */
|
|
87
87
|
currentUpdateSet: (scope?: string) => Promise<{
|
|
88
88
|
sys_id: string;
|
|
89
89
|
name: string;
|
|
90
90
|
}>;
|
|
91
|
-
/** GET /api/cadso/
|
|
91
|
+
/** GET /api/cadso/dovetail_core/changeUpdateSet?sysId=... — pins the REST session's active update set. */
|
|
92
92
|
changeUpdateSet: (params: {
|
|
93
93
|
sysId: string;
|
|
94
94
|
}) => Promise<{
|
|
95
95
|
[k: string]: any;
|
|
96
96
|
}>;
|
|
97
|
-
/** POST /api/cadso/
|
|
97
|
+
/** POST /api/cadso/dovetail_core/deleteRecord — body { table, sys_id }. Returns the deleted record. */
|
|
98
98
|
deleteRecord: (params: {
|
|
99
99
|
table: string;
|
|
100
100
|
sys_id: string;
|
package/dist/client.js
CHANGED
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
* - `buildAgent.*` — reads via the sn_build_agent API, with graceful
|
|
8
8
|
* fallback to Table API / sys_dictionary when the
|
|
9
9
|
* Build Agent plugin is unavailable
|
|
10
|
-
* - `claude.*` — writes via the Dovetail Scripted REST API
|
|
11
|
-
* (/api/cadso/
|
|
12
|
-
* switching atomically so every write lands in the
|
|
13
|
-
* update set without touching sys_user_preference.
|
|
14
|
-
* Falls back to the legacy /api/cadso/
|
|
15
|
-
* instances
|
|
16
|
-
* The
|
|
17
|
-
* compatibility; the
|
|
18
|
-
*
|
|
10
|
+
* - `claude.*` — writes via the Dovetail core Scripted REST API
|
|
11
|
+
* (/api/cadso/dovetail_core/*), which handles update-set +
|
|
12
|
+
* scope switching atomically so every write lands in the
|
|
13
|
+
* right update set without touching sys_user_preference.
|
|
14
|
+
* Falls back to the legacy global-scope /api/cadso/dovetail/*
|
|
15
|
+
* path on instances without the Dovetail app installed.
|
|
16
|
+
* The `claude.*` property name is preserved for API
|
|
17
|
+
* compatibility; the server-side API now lives in the
|
|
18
|
+
* Dovetail scoped application as "Dovetail Core".
|
|
19
19
|
*
|
|
20
20
|
* Env fallbacks mirror prior dashboard-fetch helpers so dev setups that already
|
|
21
21
|
* have SN_INSTANCE/SN_USER/SN_PASSWORD work without reconfiguration.
|
|
@@ -104,11 +104,12 @@ function createClient(config = {}) {
|
|
|
104
104
|
validateStatus: function () { return true; }
|
|
105
105
|
});
|
|
106
106
|
var lastAt = 0;
|
|
107
|
-
// Dovetail Scripted REST API
|
|
108
|
-
//
|
|
109
|
-
//
|
|
110
|
-
// the
|
|
111
|
-
|
|
107
|
+
// Dovetail core Scripted REST API: prefer the Dovetail-app path
|
|
108
|
+
// /api/cadso/dovetail_core/* and fall back to the legacy global-scope path
|
|
109
|
+
// /api/cadso/dovetail/* on instances that don't have the Dovetail app yet.
|
|
110
|
+
// Latch the legacy flag after the first 404 to avoid paying the round-trip
|
|
111
|
+
// cost on every subsequent call.
|
|
112
|
+
var useDovetailLegacyPath = false;
|
|
112
113
|
async function request(cfg, ctx) {
|
|
113
114
|
var attempt429 = 0;
|
|
114
115
|
var attempt5xx = 0;
|
|
@@ -160,24 +161,24 @@ function createClient(config = {}) {
|
|
|
160
161
|
return res.data;
|
|
161
162
|
}
|
|
162
163
|
}
|
|
163
|
-
// Dovetail Scripted REST API request: try /api/cadso/
|
|
164
|
-
// /api/cadso/
|
|
164
|
+
// Dovetail core Scripted REST API request: try /api/cadso/dovetail_core/<op>,
|
|
165
|
+
// fall back to the legacy /api/cadso/dovetail/<op> on 404 (one-time warning).
|
|
165
166
|
async function dovetailRequest(method, op, body, params, ctx) {
|
|
166
|
-
var url =
|
|
167
|
-
? "/api/cadso/
|
|
168
|
-
: "/api/cadso/
|
|
167
|
+
var url = useDovetailLegacyPath
|
|
168
|
+
? "/api/cadso/dovetail/" + op
|
|
169
|
+
: "/api/cadso/dovetail_core/" + op;
|
|
169
170
|
try {
|
|
170
171
|
return await request({ method: method, url: url, data: body, params: params }, ctx);
|
|
171
172
|
}
|
|
172
173
|
catch (e) {
|
|
173
174
|
var msg = e && e.message ? String(e.message) : "";
|
|
174
|
-
if (!
|
|
175
|
+
if (!useDovetailLegacyPath && msg.indexOf("SN 404 on") === 0) {
|
|
175
176
|
// eslint-disable-next-line no-console
|
|
176
|
-
console.warn("[deprecation] /api/cadso/
|
|
177
|
-
" returned 404. Falling back to legacy /api/cadso/
|
|
178
|
-
".
|
|
179
|
-
|
|
180
|
-
var legacyUrl = "/api/cadso/
|
|
177
|
+
console.warn("[deprecation] /api/cadso/dovetail_core/" + op +
|
|
178
|
+
" returned 404. Falling back to legacy /api/cadso/dovetail/" + op +
|
|
179
|
+
". Install the Dovetail application's Scripted REST APIs to silence this warning.");
|
|
180
|
+
useDovetailLegacyPath = true;
|
|
181
|
+
var legacyUrl = "/api/cadso/dovetail/" + op;
|
|
181
182
|
return await request({ method: method, url: legacyUrl, data: body, params: params }, ctx);
|
|
182
183
|
}
|
|
183
184
|
throw e;
|