@researchdatabox/sails-hook-redbox-servicenow-catalog 0.0.13 → 1.0.0-beta.43
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 +290 -74
- package/dist/api/configmodels/ServiceNowCatalogAppConfig.d.ts +1045 -0
- package/dist/api/configmodels/ServiceNowCatalogAppConfig.d.ts.map +1 -0
- package/dist/api/configmodels/ServiceNowCatalogAppConfig.js +269 -0
- package/dist/api/controllers/CatalogController.d.ts +24 -0
- package/dist/api/controllers/CatalogController.d.ts.map +1 -0
- package/dist/api/controllers/CatalogController.js +206 -0
- package/dist/api/controllers/index.d.ts +8 -0
- package/dist/api/controllers/index.d.ts.map +1 -0
- package/dist/api/controllers/index.js +16 -0
- package/dist/api/models/ServicenowCatalogIdempotency.d.ts +18 -0
- package/dist/api/models/ServicenowCatalogIdempotency.d.ts.map +1 -0
- package/dist/api/models/ServicenowCatalogIdempotency.js +76 -0
- package/dist/api/models/index.d.ts +5 -0
- package/dist/api/models/index.d.ts.map +1 -0
- package/dist/api/models/index.js +23 -0
- package/dist/api/services/ServicenowCatalogService.d.ts +60 -0
- package/dist/api/services/ServicenowCatalogService.d.ts.map +1 -0
- package/dist/api/services/ServicenowCatalogService.js +848 -0
- package/dist/api/services/index.d.ts +8 -0
- package/dist/api/services/index.d.ts.map +1 -0
- package/dist/api/services/index.js +16 -0
- package/dist/api/services/servicenow/audit.d.ts +91 -0
- package/dist/api/services/servicenow/audit.d.ts.map +1 -0
- package/dist/api/services/servicenow/audit.js +230 -0
- package/dist/api/services/servicenow/configuration.d.ts +26 -0
- package/dist/api/services/servicenow/configuration.d.ts.map +1 -0
- package/dist/api/services/servicenow/configuration.js +105 -0
- package/dist/api/services/servicenow/context.d.ts +29 -0
- package/dist/api/services/servicenow/context.d.ts.map +1 -0
- package/dist/api/services/servicenow/context.js +7 -0
- package/dist/api/services/servicenow/errors.d.ts +133 -0
- package/dist/api/services/servicenow/errors.d.ts.map +1 -0
- package/dist/api/services/servicenow/errors.js +204 -0
- package/dist/api/services/servicenow/http.d.ts +16 -0
- package/dist/api/services/servicenow/http.d.ts.map +1 -0
- package/dist/api/services/servicenow/http.js +168 -0
- package/dist/api/services/servicenow/idempotency.d.ts +29 -0
- package/dist/api/services/servicenow/idempotency.d.ts.map +1 -0
- package/dist/api/services/servicenow/idempotency.js +119 -0
- package/dist/api/services/servicenow/mapping.d.ts +27 -0
- package/dist/api/services/servicenow/mapping.d.ts.map +1 -0
- package/dist/api/services/servicenow/mapping.js +145 -0
- package/dist/api/services/servicenow/normalizeResponse.d.ts +4 -0
- package/dist/api/services/servicenow/normalizeResponse.d.ts.map +1 -0
- package/dist/api/services/servicenow/normalizeResponse.js +16 -0
- package/dist/api/services/servicenow/runtime.d.ts +8 -0
- package/dist/api/services/servicenow/runtime.d.ts.map +1 -0
- package/dist/api/services/servicenow/runtime.js +44 -0
- package/dist/config/auth.d.ts +3 -0
- package/dist/config/auth.d.ts.map +1 -0
- package/dist/config/auth.js +13 -0
- package/dist/config/servicenow.d.ts +7 -0
- package/dist/config/servicenow.d.ts.map +1 -0
- package/dist/config/servicenow.js +10 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +111 -0
- package/language-defaults/.gitkeep +1 -0
- package/{locales → language-defaults}/en/translation.json +8 -3
- package/package.json +39 -41
- package/.circleci/config.yml +0 -33
- package/.editorconfig +0 -13
- package/.nvmrc +0 -1
- package/angular/catalog/.angular-cli.json +0 -60
- package/angular/catalog/.editorconfig +0 -13
- package/angular/catalog/README.md +0 -27
- package/angular/catalog/buildAngularProd.sh +0 -3
- package/angular/catalog/dist/3rdpartylicenses.txt +0 -2215
- package/angular/catalog/dist/assets/images/aws_ec2.png +0 -0
- package/angular/catalog/dist/assets/images/catalog.png +0 -0
- package/angular/catalog/dist/assets/images/cloudstor.png +0 -0
- package/angular/catalog/dist/assets/images/limesurvey.png +0 -0
- package/angular/catalog/dist/assets/images/omeka.png +0 -0
- package/angular/catalog/dist/assets/images/qualtrics.png +0 -0
- package/angular/catalog/dist/assets/images/storage.png +0 -0
- package/angular/catalog/dist/assets/images/uts_hpcc.png +0 -0
- package/angular/catalog/dist/assets/images/uts_hpcs.png +0 -0
- package/angular/catalog/dist/assets/images/uts_ihpc.png +0 -0
- package/angular/catalog/dist/favicon.ico +0 -0
- package/angular/catalog/dist/index.html +0 -1
- package/angular/catalog/dist/inline.bundle.js +0 -1
- package/angular/catalog/dist/main.bundle.js +0 -1
- package/angular/catalog/dist/polyfills.bundle.js +0 -1
- package/angular/catalog/dist/styles.bundle.css +0 -0
- package/angular/catalog/e2e/app.e2e-spec.ts +0 -14
- package/angular/catalog/e2e/app.po.ts +0 -11
- package/angular/catalog/e2e/tsconfig.e2e.json +0 -14
- package/angular/catalog/karma.conf.js +0 -33
- package/angular/catalog/package-lock.json +0 -11967
- package/angular/catalog/package.json +0 -71
- package/angular/catalog/protractor.conf.js +0 -28
- package/angular/catalog/src/app/catalog-form.component.css +0 -6
- package/angular/catalog/src/app/catalog-form.component.spec.ts +0 -27
- package/angular/catalog/src/app/catalog-form.component.ts +0 -201
- package/angular/catalog/src/app/catalog-form.html +0 -24
- package/angular/catalog/src/app/catalog.module.ts +0 -30
- package/angular/catalog/src/app/catalog.service.ts +0 -97
- package/angular/catalog/src/app/components/catalog-display.component.ts +0 -212
- package/angular/catalog/src/app/components/request-box.component.ts +0 -489
- package/angular/catalog/src/assets/.gitkeep +0 -0
- package/angular/catalog/src/assets/images/aws_ec2.png +0 -0
- package/angular/catalog/src/assets/images/catalog.png +0 -0
- package/angular/catalog/src/assets/images/cloudstor.png +0 -0
- package/angular/catalog/src/assets/images/limesurvey.png +0 -0
- package/angular/catalog/src/assets/images/omeka.png +0 -0
- package/angular/catalog/src/assets/images/qualtrics.png +0 -0
- package/angular/catalog/src/assets/images/storage.png +0 -0
- package/angular/catalog/src/assets/images/uts_hpcc.png +0 -0
- package/angular/catalog/src/assets/images/uts_hpcs.png +0 -0
- package/angular/catalog/src/assets/images/uts_ihpc.png +0 -0
- package/angular/catalog/src/environments/environment.prod.ts +0 -3
- package/angular/catalog/src/environments/environment.ts +0 -8
- package/angular/catalog/src/favicon.ico +0 -0
- package/angular/catalog/src/index.html +0 -14
- package/angular/catalog/src/main.ts +0 -12
- package/angular/catalog/src/polyfills.ts +0 -79
- package/angular/catalog/src/styles.css +0 -1
- package/angular/catalog/src/test.ts +0 -20
- package/angular/catalog/src/tsconfig.app.json +0 -13
- package/angular/catalog/src/tsconfig.spec.json +0 -19
- package/angular/catalog/src/typings.d.ts +0 -5
- package/angular/catalog/tsconfig.json +0 -31
- package/angular/catalog/tslint.json +0 -143
- package/angular/catalog/~/source/code.research/redbox-portal/.tmp/public/angular/catalog/assets/images/catalog.png +0 -0
- package/angular/catalog/~/source/code.research/redbox-portal/.tmp/public/angular/catalog/favicon.ico +0 -0
- package/angular/catalog/~/source/code.research/redbox-portal/.tmp/public/angular/catalog/index.html +0 -14
- package/angular/catalog/~/source/code.research/redbox-portal/.tmp/public/angular/catalog/inline.bundle.js +0 -102
- package/angular/catalog/~/source/code.research/redbox-portal/.tmp/public/angular/catalog/inline.bundle.js.map +0 -1
- package/angular/catalog/~/source/code.research/redbox-portal/.tmp/public/angular/catalog/main.bundle.js +0 -9817
- package/angular/catalog/~/source/code.research/redbox-portal/.tmp/public/angular/catalog/main.bundle.js.map +0 -1
- package/angular/catalog/~/source/code.research/redbox-portal/.tmp/public/angular/catalog/polyfills.bundle.js +0 -5057
- package/angular/catalog/~/source/code.research/redbox-portal/.tmp/public/angular/catalog/polyfills.bundle.js.map +0 -1
- package/angular/catalog/~/source/code.research/redbox-portal/.tmp/public/angular/catalog/styles.bundle.js +0 -520
- package/angular/catalog/~/source/code.research/redbox-portal/.tmp/public/angular/catalog/styles.bundle.js.map +0 -1
- package/angular/catalog/~/source/code.research/redbox-portal/.tmp/public/angular/catalog/vendor.bundle.js +0 -232274
- package/angular/catalog/~/source/code.research/redbox-portal/.tmp/public/angular/catalog/vendor.bundle.js.map +0 -1
- package/api/Config.js +0 -42
- package/api/controllers/CatalogController.js +0 -211
- package/api/services/ServicenowCatalogService.js +0 -214
- package/assets/images/blank.png +0 -0
- package/config/auth.js +0 -82
- package/config/env/docker.js +0 -34
- package/config/servicenow-catalog-general.js +0 -58
- package/config/servicenow-catalog-recordtype.js +0 -36
- package/config/servicenow-catalog-routes.js +0 -17
- package/config/servicenow-catalog-workflow.js +0 -79
- package/config/servicenow-catalog-workspacetype.js +0 -9
- package/form-config/servicenow-catalog-1.0.js +0 -195
- package/index.js +0 -20
- package/runForDev.sh +0 -97
- package/support/development/docker-compose.yml +0 -43
- package/support/development/linkHook.sh +0 -9
- package/support/development/monitorSailsWorkingDir.sh +0 -46
- package/support/doc/images/service-catalog-in-rdmp.png +0 -0
- package/support/doc/images/service-catalog-storage.png +0 -0
- package/support/doc/images/service-catalog.png +0 -0
- package/test/dependencies.spec.js +0 -71
- package/tsconfig.json +0 -45
- package/typescript/api/Config.ts +0 -62
- package/typescript/api/controllers/CatalogController.ts +0 -248
- package/typescript/api/services/ServicenowCatalogService.ts +0 -201
package/README.md
CHANGED
|
@@ -1,85 +1,301 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
##
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
# ServiceNow Catalog Hook for ReDBox v5
|
|
2
|
+
|
|
3
|
+
This hook provides reusable ServiceNow catalog submission mechanics for ReDBox.
|
|
4
|
+
Customer hooks own record types, forms, workflows, and the decision to submit.
|
|
5
|
+
This hook owns named catalog configuration, mapping, OAuth, HTTP retries and
|
|
6
|
+
timeouts, optional parent association, response write-back, auditing, and
|
|
7
|
+
opt-in idempotency.
|
|
8
|
+
|
|
9
|
+
The hook does not register a `servicenow-catalog` record type, workspace type,
|
|
10
|
+
workflow, form, Angular application, view, or navigation entry.
|
|
11
|
+
|
|
12
|
+
## Configuration
|
|
13
|
+
|
|
14
|
+
`servicenowCatalog` is brand-aware and disabled by default. It contains any
|
|
15
|
+
number of named catalog definitions:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"enabled": true,
|
|
20
|
+
"catalogs": {
|
|
21
|
+
"storage-new": {
|
|
22
|
+
"enabled": true,
|
|
23
|
+
"connection": {
|
|
24
|
+
"url": "https://example.service-now.com/api/sn_sc/servicecatalog/items/ITEM_ID/order_now",
|
|
25
|
+
"method": "post",
|
|
26
|
+
"headers": {
|
|
27
|
+
"Authorization": "Basic BASE64_CREDENTIALS"
|
|
28
|
+
},
|
|
29
|
+
"timeoutMs": 30000,
|
|
30
|
+
"totalTimeoutMs": 120000,
|
|
31
|
+
"retry": {
|
|
32
|
+
"maxAttempts": 3,
|
|
33
|
+
"baseDelayMs": 1000,
|
|
34
|
+
"maxDelayMs": 10000,
|
|
35
|
+
"retryOnStatusCodes": [408, 429, 500, 502, 503, 504]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"oauth": {
|
|
39
|
+
"enabled": false,
|
|
40
|
+
"url": "",
|
|
41
|
+
"clientId": "",
|
|
42
|
+
"clientSecret": "",
|
|
43
|
+
"grantType": "client_credentials"
|
|
44
|
+
},
|
|
45
|
+
"bodyTemplate": {
|
|
46
|
+
"sysparm_quantity": "1",
|
|
47
|
+
"get_portal_messages": "true",
|
|
48
|
+
"variables": {}
|
|
49
|
+
},
|
|
50
|
+
"requestFields": [
|
|
51
|
+
{
|
|
52
|
+
"destination": "variables.short_description",
|
|
53
|
+
"source": {
|
|
54
|
+
"kind": "handlebars",
|
|
55
|
+
"template": "{{workspace.metadata.title}}"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"destination": "variables.requested_size",
|
|
60
|
+
"source": {
|
|
61
|
+
"kind": "jsonata",
|
|
62
|
+
"expression": "workspace.metadata.storage_size"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"responseFields": {
|
|
67
|
+
"workspace": [
|
|
68
|
+
{
|
|
69
|
+
"destination": "metadata.servicenow_number",
|
|
70
|
+
"source": {
|
|
71
|
+
"kind": "path",
|
|
72
|
+
"path": "response.result.number"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"destination": "metadata.status",
|
|
77
|
+
"source": {
|
|
78
|
+
"kind": "path",
|
|
79
|
+
"path": "response.result.state",
|
|
80
|
+
"defaultValue": "Provisioning"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"parentRecord": [
|
|
85
|
+
{
|
|
86
|
+
"destination": "metadata.storage_request_number",
|
|
87
|
+
"source": {
|
|
88
|
+
"kind": "path",
|
|
89
|
+
"path": "response.result.number"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
"parentRecord": {
|
|
95
|
+
"oid": {
|
|
96
|
+
"kind": "path",
|
|
97
|
+
"path": "workspace.metadata.parentOid"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"responseNormalization": {
|
|
101
|
+
"parseJsonString": true
|
|
102
|
+
},
|
|
103
|
+
"idempotency": {
|
|
104
|
+
"enabled": true,
|
|
105
|
+
"key": {
|
|
106
|
+
"kind": "handlebars",
|
|
107
|
+
"template": "{{oid}}:{{trigger.event}}:storage-new"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
36
113
|
```
|
|
37
114
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
115
|
+
Hook defaults are merged with brand configuration, with the brand values taking
|
|
116
|
+
precedence. New configuration must use named catalogs. The previous
|
|
117
|
+
single-catalog shape is temporarily accepted as a catalog named `default` and
|
|
118
|
+
emits a deprecation warning.
|
|
119
|
+
|
|
120
|
+
The application-configuration model declares the Authorization header, OAuth
|
|
121
|
+
client secret, password, and refresh token as secrets. Do not put credentials
|
|
122
|
+
in mappings, audit summaries, source control, or trigger options.
|
|
123
|
+
|
|
124
|
+
### OAuth
|
|
125
|
+
|
|
126
|
+
OAuth client-credentials, password, and refresh-token grants are supported.
|
|
127
|
+
When OAuth is enabled, the access token is fetched through the shared HTTP
|
|
128
|
+
runtime and reused across retries for one submission. Additional connection
|
|
129
|
+
headers are still applied, with the OAuth bearer token taking precedence over
|
|
130
|
+
an Authorization header.
|
|
131
|
+
|
|
132
|
+
## Calling the service
|
|
133
|
+
|
|
134
|
+
A customer-owned save hook calls the standard exported service:
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
const result = await sails.services.servicenowcatalogservice.submitRequest(
|
|
138
|
+
oid,
|
|
139
|
+
workspaceData,
|
|
140
|
+
{
|
|
141
|
+
catalog: 'storage-new',
|
|
142
|
+
event: 'create',
|
|
143
|
+
// Optional when the catalog's idempotency binding resolves a key.
|
|
144
|
+
idempotencyKey: oid + ':create:storage-new',
|
|
145
|
+
// Optional when the caller has already resolved the relationship.
|
|
146
|
+
parentRecordOid: workspaceData.metadata.parentOid
|
|
147
|
+
},
|
|
148
|
+
req.user,
|
|
149
|
+
response
|
|
150
|
+
);
|
|
44
151
|
```
|
|
45
152
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
153
|
+
`catalog` and `event` are required. Runtime options cannot replace catalog
|
|
154
|
+
URLs, credentials, body templates, retry policy, or mappings. An integration or
|
|
155
|
+
catalog that is explicitly disabled returns the incoming trigger response
|
|
156
|
+
unchanged. Validation, duplicate, mapping, parent, OAuth, request, timeout, and
|
|
157
|
+
write-back failures return the normal structured trigger failure without
|
|
158
|
+
deleting the saved workspace.
|
|
159
|
+
|
|
160
|
+
## Mapping contract
|
|
161
|
+
|
|
162
|
+
Request and response fields use the core `ValueBinding` model:
|
|
163
|
+
|
|
164
|
+
- `path`: read a dot-notation path;
|
|
165
|
+
- `handlebars`: render a Handlebars template;
|
|
166
|
+
- `jsonata`: evaluate a JSONata expression.
|
|
167
|
+
|
|
168
|
+
Every request mapping receives this stable context:
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
{
|
|
172
|
+
workspace,
|
|
173
|
+
parentRecord, // undefined when the catalog has no parent
|
|
174
|
+
oid,
|
|
175
|
+
brand, // resolved brand name
|
|
176
|
+
trigger: {
|
|
177
|
+
catalog,
|
|
178
|
+
event,
|
|
179
|
+
idempotencyKey?,
|
|
180
|
+
parentRecordOid?
|
|
181
|
+
},
|
|
182
|
+
now, // ISO-8601 string
|
|
183
|
+
translationService
|
|
184
|
+
}
|
|
51
185
|
```
|
|
52
|
-
ReDBox Sails Hook Run Utility
|
|
53
|
-
Usage: ./runForDev.sh [-a|--(no-)angular] [-h|--help]
|
|
54
|
-
-a,--angular,--no-angular: Angular mode. Will ensure permissions are set correctly on the Sails working directory so that changes can be applied (off by default)
|
|
55
|
-
-h,--help: Prints help
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Note: The first time the stack runs it may take some time as yarn initialises the hook within ReDBox Portal. All subsequent runs should be faster
|
|
59
|
-
|
|
60
|
-
### Usage #2
|
|
61
|
-
|
|
62
|
-
Using Vagrant : https://github.com/moisbo/vagrant-redbox-dev
|
|
63
|
-
|
|
64
|
-
And configure sync
|
|
65
|
-
|
|
66
|
-
config.vm.synced_folder "{source}/sails-hook-redbox-catalog", "/opt/hooks/sails-hook-redbox-catalog", id: "catalog"
|
|
67
186
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
187
|
+
Response mappings receive the same values plus `response`, containing the
|
|
188
|
+
normalized ServiceNow response. New response mappings should use paths such as
|
|
189
|
+
`response.result.number`. A temporary raw-response root alias is retained for
|
|
190
|
+
older `result.*` mappings.
|
|
191
|
+
|
|
192
|
+
Mappings are applied to clones and reject prototype-polluting destination
|
|
193
|
+
paths. Workspace and parent mappings are independent. Metadata is written only
|
|
194
|
+
when the corresponding mapping list is non-empty. The service never assigns a
|
|
195
|
+
hard-coded status; status changes must be expressed as ordinary response
|
|
196
|
+
mappings, binding defaults, or expressions.
|
|
197
|
+
|
|
198
|
+
## Parent records
|
|
199
|
+
|
|
200
|
+
Parent handling is optional and relationship-neutral. A caller can supply
|
|
201
|
+
`parentRecordOid`, or the catalog can resolve it from `parentRecord.oid`.
|
|
202
|
+
When configured, the OID must be non-empty and the record must exist. The
|
|
203
|
+
service loads the parent through `RecordsService`, associates the workspace
|
|
204
|
+
through `WorkspaceService.addWorkspaceToRecord`, and applies optional parent
|
|
205
|
+
response mappings through `RecordsService.updateMeta`.
|
|
206
|
+
|
|
207
|
+
Catalogs without a parent binding perform no parent lookup, association, or
|
|
208
|
+
parent update. No generic code assumes `metadata.rdmpOid`.
|
|
209
|
+
|
|
210
|
+
## Response normalization
|
|
211
|
+
|
|
212
|
+
With `responseNormalization.parseJsonString` enabled (the default), an HTTP
|
|
213
|
+
response whose root value is a JSON-encoded string is parsed before response
|
|
214
|
+
mapping. Object and array responses are unchanged. A root string that is not
|
|
215
|
+
valid JSON is preserved as a string.
|
|
216
|
+
|
|
217
|
+
## Auditing and idempotency
|
|
218
|
+
|
|
219
|
+
The integration audit records the overall submission and nested phases for
|
|
220
|
+
parent lookup, association, ServiceNow HTTP work, workspace update, parent
|
|
221
|
+
update, and idempotency decisions. Request summaries include the selected
|
|
222
|
+
catalog, trigger event, optional parent OID, and stable idempotency key, but not
|
|
223
|
+
credentials or full request bodies.
|
|
224
|
+
|
|
225
|
+
Idempotency is disabled by default. When enabled, a key must come from the
|
|
226
|
+
trigger or the configured binding. The hook-owned
|
|
227
|
+
`ServicenowCatalogIdempotency` Waterline model is the atomic durable claim
|
|
228
|
+
ledger. Its primary key is derived from an unambiguous JSON-array encoding of
|
|
229
|
+
brand ID, record OID, catalog, and idempotency key. Integration audit history
|
|
230
|
+
provides the submission evidence used to reconcile claim state:
|
|
231
|
+
|
|
232
|
+
- a prior completed key is rejected as a duplicate;
|
|
233
|
+
- a prior started/interrupted key is rejected because ServiceNow may have
|
|
234
|
+
accepted the request;
|
|
235
|
+
- a prior failed trace can be retried;
|
|
236
|
+
- an in-process guard also rejects concurrent duplicates in one portal process.
|
|
237
|
+
|
|
238
|
+
Claims move through `claimed`, `completed`, `failed`, and `uncertain`.
|
|
239
|
+
A `claimed` row is leased for the greater of five minutes or the configured
|
|
240
|
+
`totalTimeoutMs` plus a one-minute safety margin, so the lease covers the
|
|
241
|
+
complete orchestration side-effect window. After expiry, one process atomically
|
|
242
|
+
takes reconciliation ownership and checks ServiceNow-scoped audit history
|
|
243
|
+
before doing anything external: a successful trace becomes `completed`, a
|
|
244
|
+
started or interrupted trace becomes `uncertain`, and a clear trace may be
|
|
245
|
+
submitted again. If reconciliation lookup itself fails, a recovered stale
|
|
246
|
+
claim becomes `uncertain` rather than retryable.
|
|
247
|
+
|
|
248
|
+
Completed and uncertain rows have no automatic retention expiry because deleting
|
|
249
|
+
them re-enables their keys. Operators may remove them only when the corresponding
|
|
250
|
+
idempotency-key protection window has deliberately ended. Failed rows are
|
|
251
|
+
retained until atomically reclaimed by a later attempt.
|
|
252
|
+
|
|
253
|
+
## Legacy compatibility endpoints
|
|
254
|
+
|
|
255
|
+
These routes remain for compatibility only and are not the reusable save-hook
|
|
256
|
+
API:
|
|
257
|
+
|
|
258
|
+
- `POST /:branding/:portal/ws/catalog/rdmp`
|
|
259
|
+
- `POST /:branding/:portal/ws/catalog/request`
|
|
260
|
+
- `GET /:branding/:portal/ws/catalog/info`
|
|
261
|
+
|
|
262
|
+
They continue to use the isolated legacy `sails.config.workspaces.catalog`
|
|
263
|
+
settings and their existing authorization/response conventions. The request
|
|
264
|
+
endpoint no longer falls back to hook-owned record or workflow names:
|
|
265
|
+
`workspaces.catalog.recordType` and `workspaces.catalog.workflowStage` must
|
|
266
|
+
be configured when that endpoint creates a workspace.
|
|
267
|
+
|
|
268
|
+
The historical `legacy-form-config/` and `angular/catalog/` directories are
|
|
269
|
+
migration evidence only. They are not compiled, registered, or included in the
|
|
270
|
+
published package.
|
|
271
|
+
|
|
272
|
+
## Development
|
|
273
|
+
|
|
274
|
+
Use the hook archetype scripts:
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
npm install --include=dev
|
|
278
|
+
npm run compile
|
|
279
|
+
npm run test:unit
|
|
280
|
+
npm run test:integration:mocha
|
|
281
|
+
npm run test:integration:bruno
|
|
282
|
+
```
|
|
79
283
|
|
|
80
|
-
|
|
284
|
+
The integration suites build and lift a real ReDBox portal with MongoDB and
|
|
285
|
+
Solr. Mocha covers the service orchestration and Bruno covers authorization for
|
|
286
|
+
every retained compatibility route. Clean their Docker resources when needed:
|
|
81
287
|
|
|
82
|
-
|
|
288
|
+
```bash
|
|
289
|
+
npm run test:integration:mocha:clean
|
|
290
|
+
npm run test:integration:bruno:clean
|
|
291
|
+
```
|
|
83
292
|
|
|
293
|
+
## CI and releases
|
|
84
294
|
|
|
295
|
+
CircleCI compiles and runs the unit suite for every branch. Stable Git tags
|
|
296
|
+
matching `vMAJOR.MINOR.PATCH` publish the matching package version with the npm
|
|
297
|
+
`latest` dist-tag.
|
|
85
298
|
|
|
299
|
+
Beta packages are published by triggering a CircleCI pipeline with
|
|
300
|
+
`npm_publish_mode=beta`, a stable base `npm_publish_version`, and an
|
|
301
|
+
`npm_publish_dist_tag` such as `beta`, `next`, or `alpha`.
|