@servicenow/sdk-build-plugins 2.0.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/dist/AttachmentPlugin.d.ts +253 -0
- package/dist/AttachmentPlugin.js +216 -0
- package/dist/AttachmentPlugin.js.map +1 -0
- package/dist/BusinessRulePlugin.d.ts +56 -0
- package/dist/BusinessRulePlugin.js +171 -0
- package/dist/BusinessRulePlugin.js.map +1 -0
- package/dist/CrossScopePrivilegePlugin.d.ts +22 -0
- package/dist/CrossScopePrivilegePlugin.js +42 -0
- package/dist/CrossScopePrivilegePlugin.js.map +1 -0
- package/dist/DefaultPlugin.d.ts +71 -0
- package/dist/DefaultPlugin.js +238 -0
- package/dist/DefaultPlugin.js.map +1 -0
- package/dist/IdPlugin.d.ts +17 -0
- package/dist/IdPlugin.js +45 -0
- package/dist/IdPlugin.js.map +1 -0
- package/dist/ListPlugin.d.ts +91 -0
- package/dist/ListPlugin.js +398 -0
- package/dist/ListPlugin.js.map +1 -0
- package/dist/PropertyPlugin.d.ts +122 -0
- package/dist/PropertyPlugin.js +165 -0
- package/dist/PropertyPlugin.js.map +1 -0
- package/dist/ScriptTemplatePlugin.d.ts +31 -0
- package/dist/ScriptTemplatePlugin.js +208 -0
- package/dist/ScriptTemplatePlugin.js.map +1 -0
- package/dist/UserPreferencePlugin.d.ts +16 -0
- package/dist/UserPreferencePlugin.js +30 -0
- package/dist/UserPreferencePlugin.js.map +1 -0
- package/dist/aclAndRole/AclPlugin.d.ts +117 -0
- package/dist/aclAndRole/AclPlugin.js +285 -0
- package/dist/aclAndRole/AclPlugin.js.map +1 -0
- package/dist/aclAndRole/RolePlugin.d.ts +58 -0
- package/dist/aclAndRole/RolePlugin.js +152 -0
- package/dist/aclAndRole/RolePlugin.js.map +1 -0
- package/dist/aclAndRole/Util.d.ts +3 -0
- package/dist/aclAndRole/Util.js +106 -0
- package/dist/aclAndRole/Util.js.map +1 -0
- package/dist/app/ApplicationMenuPlugin.d.ts +32 -0
- package/dist/app/ApplicationMenuPlugin.js +106 -0
- package/dist/app/ApplicationMenuPlugin.js.map +1 -0
- package/dist/atf/ATFComposer.d.ts +492 -0
- package/dist/atf/ATFComposer.js +2717 -0
- package/dist/atf/ATFComposer.js.map +1 -0
- package/dist/atf/TestPlugin.d.ts +31 -0
- package/dist/atf/TestPlugin.js +95 -0
- package/dist/atf/TestPlugin.js.map +1 -0
- package/dist/atf/index.d.ts +1 -0
- package/dist/atf/index.js +9 -0
- package/dist/atf/index.js.map +1 -0
- package/dist/db/ColumnPlugins.d.ts +278 -0
- package/dist/db/ColumnPlugins.js +112 -0
- package/dist/db/ColumnPlugins.js.map +1 -0
- package/dist/db/RecordPlugin.d.ts +208 -0
- package/dist/db/RecordPlugin.js +287 -0
- package/dist/db/RecordPlugin.js.map +1 -0
- package/dist/db/TablePlugin.d.ts +742 -0
- package/dist/db/TablePlugin.js +1249 -0
- package/dist/db/TablePlugin.js.map +1 -0
- package/dist/db/index.d.ts +3 -0
- package/dist/db/index.js +27 -0
- package/dist/db/index.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/scriptedRESTAPI/RESTDeserializationUtils.d.ts +12 -0
- package/dist/scriptedRESTAPI/RESTDeserializationUtils.js +371 -0
- package/dist/scriptedRESTAPI/RESTDeserializationUtils.js.map +1 -0
- package/dist/scriptedRESTAPI/RESTSerializationUtils.d.ts +15 -0
- package/dist/scriptedRESTAPI/RESTSerializationUtils.js +177 -0
- package/dist/scriptedRESTAPI/RESTSerializationUtils.js.map +1 -0
- package/dist/scriptedRESTAPI/RestApiPlugin.d.ts +144 -0
- package/dist/scriptedRESTAPI/RestApiPlugin.js +318 -0
- package/dist/scriptedRESTAPI/RestApiPlugin.js.map +1 -0
- package/dist/scriptedRESTAPI/RestSchemaUtils.d.ts +190 -0
- package/dist/scriptedRESTAPI/RestSchemaUtils.js +53 -0
- package/dist/scriptedRESTAPI/RestSchemaUtils.js.map +1 -0
- package/dist/scriptedRESTAPI/RestUtils.d.ts +75 -0
- package/dist/scriptedRESTAPI/RestUtils.js +469 -0
- package/dist/scriptedRESTAPI/RestUtils.js.map +1 -0
- package/dist/scripts/ClientScriptPlugin.d.ts +43 -0
- package/dist/scripts/ClientScriptPlugin.js +190 -0
- package/dist/scripts/ClientScriptPlugin.js.map +1 -0
- package/dist/scripts/scriptUtils.d.ts +15 -0
- package/dist/scripts/scriptUtils.js +83 -0
- package/dist/scripts/scriptUtils.js.map +1 -0
- package/dist/uxf/ExperiencePlugin.d.ts +22 -0
- package/dist/uxf/ExperiencePlugin.js +55 -0
- package/dist/uxf/ExperiencePlugin.js.map +1 -0
- package/dist/uxf/RoutesPlugin.d.ts +22 -0
- package/dist/uxf/RoutesPlugin.js +176 -0
- package/dist/uxf/RoutesPlugin.js.map +1 -0
- package/dist/uxf/UxfFormulaParser/cleanUxValue.d.ts +4 -0
- package/dist/uxf/UxfFormulaParser/cleanUxValue.js +65 -0
- package/dist/uxf/UxfFormulaParser/cleanUxValue.js.map +1 -0
- package/dist/uxf/UxfFormulaParser/grammerParser/api.d.ts +189 -0
- package/dist/uxf/UxfFormulaParser/grammerParser/api.js +158 -0
- package/dist/uxf/UxfFormulaParser/grammerParser/api.js.map +1 -0
- package/dist/uxf/UxfFormulaParser/grammerParser/clientTransformMap.d.ts +13 -0
- package/dist/uxf/UxfFormulaParser/grammerParser/clientTransformMap.js +604 -0
- package/dist/uxf/UxfFormulaParser/grammerParser/clientTransformMap.js.map +1 -0
- package/dist/uxf/UxfFormulaParser/grammerParser/grammarParser.d.ts +12 -0
- package/dist/uxf/UxfFormulaParser/grammerParser/grammarParser.js +551 -0
- package/dist/uxf/UxfFormulaParser/grammerParser/grammarParser.js.map +1 -0
- package/dist/uxf/UxfFormulaParser/grammerParser/spanHelpers.d.ts +31 -0
- package/dist/uxf/UxfFormulaParser/grammerParser/spanHelpers.js +64 -0
- package/dist/uxf/UxfFormulaParser/grammerParser/spanHelpers.js.map +1 -0
- package/dist/uxf/UxfFormulaParser/index.d.ts +3 -0
- package/dist/uxf/UxfFormulaParser/index.js +11 -0
- package/dist/uxf/UxfFormulaParser/index.js.map +1 -0
- package/dist/uxf/UxfFormulaParser/parser.d.ts +8 -0
- package/dist/uxf/UxfFormulaParser/parser.js +87 -0
- package/dist/uxf/UxfFormulaParser/parser.js.map +1 -0
- package/dist/uxf/UxfFormulaParser/utils/getErrorMsg.d.ts +8 -0
- package/dist/uxf/UxfFormulaParser/utils/getErrorMsg.js +17 -0
- package/dist/uxf/UxfFormulaParser/utils/getErrorMsg.js.map +1 -0
- package/dist/uxf/constants.d.ts +2 -0
- package/dist/uxf/constants.js +8 -0
- package/dist/uxf/constants.js.map +1 -0
- package/dist/uxf/index.d.ts +2 -0
- package/dist/uxf/index.js +11 -0
- package/dist/uxf/index.js.map +1 -0
- package/dist/uxf/tectonicIdGenerator.d.ts +12 -0
- package/dist/uxf/tectonicIdGenerator.js +102 -0
- package/dist/uxf/tectonicIdGenerator.js.map +1 -0
- package/license +9 -0
- package/package.json +42 -0
- package/src/AttachmentPlugin.ts +262 -0
- package/src/BusinessRulePlugin.ts +251 -0
- package/src/CrossScopePrivilegePlugin.ts +54 -0
- package/src/DefaultPlugin.ts +272 -0
- package/src/IdPlugin.ts +47 -0
- package/src/ListPlugin.ts +497 -0
- package/src/PropertyPlugin.ts +218 -0
- package/src/ScriptTemplatePlugin.ts +223 -0
- package/src/UserPreferencePlugin.ts +36 -0
- package/src/aclAndRole/AclPlugin.ts +410 -0
- package/src/aclAndRole/RolePlugin.ts +225 -0
- package/src/aclAndRole/Util.ts +104 -0
- package/src/app/ApplicationMenuPlugin.ts +158 -0
- package/src/atf/ATFComposer.ts +3356 -0
- package/src/atf/TestPlugin.ts +119 -0
- package/src/atf/index.ts +1 -0
- package/src/db/ColumnPlugins.ts +117 -0
- package/src/db/RecordPlugin.ts +391 -0
- package/src/db/TablePlugin.ts +1581 -0
- package/src/db/index.ts +3 -0
- package/src/index.ts +16 -0
- package/src/scriptedRESTAPI/RESTDeserializationUtils.ts +410 -0
- package/src/scriptedRESTAPI/RESTSerializationUtils.ts +227 -0
- package/src/scriptedRESTAPI/RestApiPlugin.ts +438 -0
- package/src/scriptedRESTAPI/RestSchemaUtils.ts +72 -0
- package/src/scriptedRESTAPI/RestUtils.ts +507 -0
- package/src/scripts/ClientScriptPlugin.ts +251 -0
- package/src/scripts/scriptUtils.ts +81 -0
- package/src/uxf/ExperiencePlugin.ts +64 -0
- package/src/uxf/RoutesPlugin.ts +215 -0
- package/src/uxf/UxfFormulaParser/cleanUxValue.ts +73 -0
- package/src/uxf/UxfFormulaParser/grammerParser/api.js +166 -0
- package/src/uxf/UxfFormulaParser/grammerParser/clientTransformMap.js +606 -0
- package/src/uxf/UxfFormulaParser/grammerParser/grammarParser.js +551 -0
- package/src/uxf/UxfFormulaParser/grammerParser/spanHelpers.js +65 -0
- package/src/uxf/UxfFormulaParser/index.ts +4 -0
- package/src/uxf/UxfFormulaParser/parser.ts +64 -0
- package/src/uxf/UxfFormulaParser/utils/getErrorMsg.ts +13 -0
- package/src/uxf/constants.ts +4 -0
- package/src/uxf/index.ts +2 -0
- package/src/uxf/tectonicIdGenerator.ts +81 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.GenericColumnPlugin = exports.OtherDateColumnPlugin = exports.ScheduleDateTimeColumnPlugin = exports.IntegerDateColumnPlugin = exports.DueDateColumnPlugin = exports.BasicDateTimeColumnPlugin = exports.CalendarDateTimeColumnPlugin = exports.DateTimeColumnPlugin = exports.DateColumnPlugin = exports.FieldNameColumnPlugin = exports.VersionColumnPlugin = exports.UserRolesColumnPlugin = exports.TranslatedTextColumnPlugin = exports.TranslatedFieldColumnPlugin = exports.TableNameColumnPlugin = exports.SystemClassNameColumnPlugin = exports.ScriptColumnPlugin = exports.RadioColumnPlugin = exports.ReferenceColumnPlugin = exports.ListColumnPlugin = exports.DomainPathColumnPlugin = exports.DomainIdColumnPlugin = exports.DocumentIdColumnPlugin = exports.DecimalColumnPlugin = exports.ChoiceColumnPlugin = exports.ConditionsColumnPlugin = exports.BasicImageColumnPlugin = exports.IntegerColumnPlugin = exports.BooleanColumnPlugin = exports.StringColumnPlugin = void 0;
|
|
27
|
+
const db = __importStar(require("@servicenow/sdk-core/runtime/db"));
|
|
28
|
+
const sdk_build_core_1 = require("@servicenow/sdk-build-core");
|
|
29
|
+
const validFunctions = [
|
|
30
|
+
'add',
|
|
31
|
+
'coalesce',
|
|
32
|
+
'concat',
|
|
33
|
+
'datediff',
|
|
34
|
+
'dayofweek',
|
|
35
|
+
'distance_sphere',
|
|
36
|
+
'divide',
|
|
37
|
+
'greatest',
|
|
38
|
+
'least',
|
|
39
|
+
'length',
|
|
40
|
+
'multiply',
|
|
41
|
+
'position',
|
|
42
|
+
'substring',
|
|
43
|
+
'subtract',
|
|
44
|
+
];
|
|
45
|
+
const regExp = new RegExp(`^glidefunction:(${validFunctions.join('|')})[(].*?[)]$`, 'g');
|
|
46
|
+
function ColumnPlugin(fn, entityKind) {
|
|
47
|
+
return (0, sdk_build_core_1.Plugin)({
|
|
48
|
+
name: `${entityKind}Column`,
|
|
49
|
+
extractors: {
|
|
50
|
+
entity: {
|
|
51
|
+
CallExpression(node, context) {
|
|
52
|
+
const result = (0, sdk_build_core_1.extractCallExpression)(fn, `${entityKind}Column`, node, context, () => 'NO_GUID_GENERATED' // TODO: We shouldn't need to generate any GUID here but maybe should provide something unique to be on the safe side
|
|
53
|
+
);
|
|
54
|
+
if (!result.handled || !(0 in result.data)) {
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
const entity = result.data[0];
|
|
58
|
+
const diagnostics = result.diagnostics;
|
|
59
|
+
const functionDefinition = entity.getProperty('function_definition')?.getValue();
|
|
60
|
+
if (functionDefinition) {
|
|
61
|
+
if (typeof functionDefinition !== 'string' || !functionDefinition.match(regExp)) {
|
|
62
|
+
diagnostics.push(new sdk_build_core_1.FluentDiagnostic(node, `'function_definition' must start with 'glidefunction:' and include a single function call to a predefined function:\n${validFunctions.join('\n')}`));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
handled: true,
|
|
67
|
+
diagnostics,
|
|
68
|
+
data: [
|
|
69
|
+
new sdk_build_core_1.EntityData(entity.getKind(), entity.getGuid(), sdk_build_core_1.ObjectData.fromObjectValue({
|
|
70
|
+
...entity.getValue(),
|
|
71
|
+
entityKind,
|
|
72
|
+
}, entity.getNode()), entity.getNode()),
|
|
73
|
+
],
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
exports.StringColumnPlugin = ColumnPlugin(db.StringColumn, 'string');
|
|
81
|
+
exports.BooleanColumnPlugin = ColumnPlugin(db.BooleanColumn, 'boolean');
|
|
82
|
+
exports.IntegerColumnPlugin = ColumnPlugin(db.IntegerColumn, 'integer');
|
|
83
|
+
exports.BasicImageColumnPlugin = ColumnPlugin(db.BasicImageColumn, 'basicImage');
|
|
84
|
+
exports.ConditionsColumnPlugin = ColumnPlugin(db.ConditionsColumn, 'conditions');
|
|
85
|
+
exports.ChoiceColumnPlugin = ColumnPlugin(db.ChoiceColumn, 'choice');
|
|
86
|
+
exports.DecimalColumnPlugin = ColumnPlugin(db.DecimalColumn, 'decimal');
|
|
87
|
+
exports.DocumentIdColumnPlugin = ColumnPlugin(db.DocumentIdColumn, 'documentId');
|
|
88
|
+
exports.DomainIdColumnPlugin = ColumnPlugin(db.DomainIdColumn, 'domainId');
|
|
89
|
+
exports.DomainPathColumnPlugin = ColumnPlugin(db.DomainPathColumn, 'domainPath');
|
|
90
|
+
exports.ListColumnPlugin = ColumnPlugin(db.ListColumn, 'list');
|
|
91
|
+
exports.ReferenceColumnPlugin = ColumnPlugin(db.ReferenceColumn, 'reference');
|
|
92
|
+
exports.RadioColumnPlugin = ColumnPlugin(db.RadioColumn, 'radio');
|
|
93
|
+
exports.ScriptColumnPlugin = ColumnPlugin(db.ScriptColumn, 'script');
|
|
94
|
+
exports.SystemClassNameColumnPlugin = ColumnPlugin(db.SystemClassNameColumn, 'systemClassName');
|
|
95
|
+
exports.TableNameColumnPlugin = ColumnPlugin(db.TableNameColumn, 'tableName');
|
|
96
|
+
exports.TranslatedFieldColumnPlugin = ColumnPlugin(db.TranslatedFieldColumn, 'translatedField');
|
|
97
|
+
exports.TranslatedTextColumnPlugin = ColumnPlugin(db.TranslatedTextColumn, 'translatedText');
|
|
98
|
+
exports.UserRolesColumnPlugin = ColumnPlugin(db.UserRolesColumn, 'userRoles');
|
|
99
|
+
exports.VersionColumnPlugin = ColumnPlugin(db.VersionColumn, 'version');
|
|
100
|
+
exports.FieldNameColumnPlugin = ColumnPlugin(db.FieldNameColumn, 'fieldName');
|
|
101
|
+
// Date columns
|
|
102
|
+
exports.DateColumnPlugin = ColumnPlugin(db.DateColumn, 'glide_date');
|
|
103
|
+
exports.DateTimeColumnPlugin = ColumnPlugin(db.DateTimeColumn, 'glide_date_time');
|
|
104
|
+
exports.CalendarDateTimeColumnPlugin = ColumnPlugin(db.CalendarDateTimeColumn, 'calendar_date_time');
|
|
105
|
+
exports.BasicDateTimeColumnPlugin = ColumnPlugin(db.BasicDateTimeColumn, 'datetime');
|
|
106
|
+
exports.DueDateColumnPlugin = ColumnPlugin(db.DueDateColumn, 'due_date');
|
|
107
|
+
exports.IntegerDateColumnPlugin = ColumnPlugin(db.IntegerDateColumn, 'integer_date');
|
|
108
|
+
exports.ScheduleDateTimeColumnPlugin = ColumnPlugin(db.ScheduleDateTimeColumn, 'schedule_date_time');
|
|
109
|
+
exports.OtherDateColumnPlugin = ColumnPlugin(db.OtherDateColumn, 'date');
|
|
110
|
+
// Catch all column type which keys of off 'internal_type'
|
|
111
|
+
exports.GenericColumnPlugin = ColumnPlugin(db.GenericColumn, 'generic');
|
|
112
|
+
//# sourceMappingURL=ColumnPlugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColumnPlugins.js","sourceRoot":"","sources":["../../src/db/ColumnPlugins.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oEAAqD;AACrD,+DAAoH;AAEpH,MAAM,cAAc,GAAG;IACnB,KAAK;IACL,UAAU;IACV,QAAQ;IACR,UAAU;IACV,WAAW;IACX,iBAAiB;IACjB,QAAQ;IACR,UAAU;IACV,OAAO;IACP,QAAQ;IACR,UAAU;IACV,UAAU;IACV,WAAW;IACX,UAAU;CACb,CAAA;AAED,MAAM,MAAM,GAA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AC5E,QAAA,4BAA4B,GAAG,YAAY,CAAC,EAAE,CAAC,sBAAsB,EAAE,oBAAoB,CAAC,CAAA;AAC5F,QAAA,qBAAqB,GAAG,YAAY,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,CAAC,CAAA;AAE7E,0DAA0D;AAC7C,QAAA,mBAAmB,GAAG,YAAY,CAAC,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC,CAAA"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { Record, TableName } from '@servicenow/sdk-core/runtime/db';
|
|
2
|
+
import { Context, XmlData, ExtractionResult, EntityData } from '@servicenow/sdk-build-core';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { CallExpression, SyntaxKind } from 'ts-morph';
|
|
5
|
+
export declare const RecordEntitySchema: z.ZodObject<{
|
|
6
|
+
$id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
7
|
+
data: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
8
|
+
table: z.ZodString;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
$id: string | number;
|
|
11
|
+
data: globalThis.Record<string, any>;
|
|
12
|
+
table: string;
|
|
13
|
+
}, {
|
|
14
|
+
$id: string | number;
|
|
15
|
+
data: globalThis.Record<string, any>;
|
|
16
|
+
table: string;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const TextStringSchema: z.ZodEffects<z.ZodObject<{
|
|
19
|
+
'#text': z.ZodString;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
'#text': string;
|
|
22
|
+
}, {
|
|
23
|
+
'#text': string;
|
|
24
|
+
}>, string, {
|
|
25
|
+
'#text': string;
|
|
26
|
+
}>;
|
|
27
|
+
export declare const TextBooleanSchema: z.ZodEffects<z.ZodObject<{
|
|
28
|
+
'#text': z.ZodBoolean;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
'#text': boolean;
|
|
31
|
+
}, {
|
|
32
|
+
'#text': boolean;
|
|
33
|
+
}>, boolean, {
|
|
34
|
+
'#text': boolean;
|
|
35
|
+
}>;
|
|
36
|
+
export declare const TextNumberSchema: z.ZodEffects<z.ZodObject<{
|
|
37
|
+
'#text': z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"">]>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
'#text': number | "";
|
|
40
|
+
}, {
|
|
41
|
+
'#text': number | "";
|
|
42
|
+
}>, number | "", {
|
|
43
|
+
'#text': number | "";
|
|
44
|
+
}>;
|
|
45
|
+
declare const SysJournalFieldSchema: z.ZodObject<{
|
|
46
|
+
element: z.ZodEffects<z.ZodObject<{
|
|
47
|
+
'#text': z.ZodString;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
'#text': string;
|
|
50
|
+
}, {
|
|
51
|
+
'#text': string;
|
|
52
|
+
}>, string, {
|
|
53
|
+
'#text': string;
|
|
54
|
+
}>;
|
|
55
|
+
element_id: z.ZodEffects<z.ZodObject<{
|
|
56
|
+
'#text': z.ZodString;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
'#text': string;
|
|
59
|
+
}, {
|
|
60
|
+
'#text': string;
|
|
61
|
+
}>, string, {
|
|
62
|
+
'#text': string;
|
|
63
|
+
}>;
|
|
64
|
+
name: z.ZodEffects<z.ZodObject<{
|
|
65
|
+
'#text': z.ZodString;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
'#text': string;
|
|
68
|
+
}, {
|
|
69
|
+
'#text': string;
|
|
70
|
+
}>, string, {
|
|
71
|
+
'#text': string;
|
|
72
|
+
}>;
|
|
73
|
+
sys_id: z.ZodEffects<z.ZodObject<{
|
|
74
|
+
'#text': z.ZodString;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
'#text': string;
|
|
77
|
+
}, {
|
|
78
|
+
'#text': string;
|
|
79
|
+
}>, string, {
|
|
80
|
+
'#text': string;
|
|
81
|
+
}>;
|
|
82
|
+
value: z.ZodEffects<z.ZodObject<{
|
|
83
|
+
'#text': z.ZodString;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
'#text': string;
|
|
86
|
+
}, {
|
|
87
|
+
'#text': string;
|
|
88
|
+
}>, string, {
|
|
89
|
+
'#text': string;
|
|
90
|
+
}>;
|
|
91
|
+
}, "strip", z.ZodTypeAny, {
|
|
92
|
+
value: string;
|
|
93
|
+
element: string;
|
|
94
|
+
element_id: string;
|
|
95
|
+
name: string;
|
|
96
|
+
sys_id: string;
|
|
97
|
+
}, {
|
|
98
|
+
value: {
|
|
99
|
+
'#text': string;
|
|
100
|
+
};
|
|
101
|
+
element: {
|
|
102
|
+
'#text': string;
|
|
103
|
+
};
|
|
104
|
+
element_id: {
|
|
105
|
+
'#text': string;
|
|
106
|
+
};
|
|
107
|
+
name: {
|
|
108
|
+
'#text': string;
|
|
109
|
+
};
|
|
110
|
+
sys_id: {
|
|
111
|
+
'#text': string;
|
|
112
|
+
};
|
|
113
|
+
}>;
|
|
114
|
+
export type SysJournalField = z.infer<typeof SysJournalFieldSchema>;
|
|
115
|
+
export declare const RecordXmlSchema: z.ZodObject<{
|
|
116
|
+
'@_action': z.ZodUnion<[z.ZodLiteral<"INSERT_OR_UPDATE">, z.ZodLiteral<"DELETE">, z.ZodLiteral<"delete_multiple">]>;
|
|
117
|
+
sys_id: z.ZodObject<{
|
|
118
|
+
'#text': z.ZodString;
|
|
119
|
+
}, "strip", z.ZodTypeAny, {
|
|
120
|
+
'#text': string;
|
|
121
|
+
}, {
|
|
122
|
+
'#text': string;
|
|
123
|
+
}>;
|
|
124
|
+
}, "strip", z.ZodIntersection<z.ZodObject<{
|
|
125
|
+
'#text': z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodUndefined]>;
|
|
126
|
+
}, "strip", z.ZodTypeAny, {
|
|
127
|
+
'#text'?: string | number | boolean | undefined;
|
|
128
|
+
}, {
|
|
129
|
+
'#text'?: string | number | boolean | undefined;
|
|
130
|
+
}>, z.ZodRecord<z.ZodString, z.ZodAny>>, {
|
|
131
|
+
sys_id: {
|
|
132
|
+
'#text': string;
|
|
133
|
+
};
|
|
134
|
+
'@_action': "INSERT_OR_UPDATE" | "DELETE" | "delete_multiple";
|
|
135
|
+
}, {
|
|
136
|
+
sys_id: {
|
|
137
|
+
'#text': string;
|
|
138
|
+
};
|
|
139
|
+
'@_action': "INSERT_OR_UPDATE" | "DELETE" | "delete_multiple";
|
|
140
|
+
}>;
|
|
141
|
+
export declare const RecordDocumentSchema: z.ZodObject<{
|
|
142
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodUndefined, z.ZodNull]>>;
|
|
143
|
+
table: z.ZodString;
|
|
144
|
+
}, "strip", z.ZodTypeAny, {
|
|
145
|
+
data: globalThis.Record<string, string | number | boolean | null | undefined>;
|
|
146
|
+
table: string;
|
|
147
|
+
}, {
|
|
148
|
+
data: globalThis.Record<string, string | number | boolean | null | undefined>;
|
|
149
|
+
table: string;
|
|
150
|
+
}>;
|
|
151
|
+
export declare const RecordPlugin: {
|
|
152
|
+
readonly name: "Record";
|
|
153
|
+
readonly extractors: {
|
|
154
|
+
readonly entity: {
|
|
155
|
+
readonly CallExpression: (node: CallExpression<import("ts-morph").ts.CallExpression>, context: Context) => ExtractionResult<EntityData<Record<keyof Now.Internal.Tables>>>;
|
|
156
|
+
};
|
|
157
|
+
readonly xml: (xml: import("@servicenow/sdk-build-core").Xml, context: Context) => XmlData<{
|
|
158
|
+
id: any;
|
|
159
|
+
table: any;
|
|
160
|
+
data: {};
|
|
161
|
+
}> | undefined;
|
|
162
|
+
};
|
|
163
|
+
readonly composers: {
|
|
164
|
+
readonly entity: {
|
|
165
|
+
readonly record: (entity: EntityData<globalThis.Record<string, unknown>>, context: Context) => {
|
|
166
|
+
kind: string;
|
|
167
|
+
node: CallExpression<import("ts-morph").ts.CallExpression> | import("ts-morph").Node<import("ts-morph").ts.EndOfFileToken> | import("ts-morph").TypeAliasDeclaration | import("ts-morph").TypeReferenceNode | import("ts-morph").TypeLiteralNode | import("ts-morph").PropertySignature | import("ts-morph").TupleTypeNode | import("ts-morph").FunctionExpression | import("ts-morph").FunctionDeclaration | import("ts-morph").ArrayLiteralExpression | import("ts-morph").StringLiteral | import("ts-morph").NumericLiteral | import("ts-morph").TrueLiteral | import("ts-morph").FalseLiteral | import("ts-morph").Identifier | import("ts-morph").SourceFile | import("ts-morph").VariableDeclaration | import("ts-morph").ClassDeclaration | import("ts-morph").ExportDeclaration | import("ts-morph").ObjectLiteralExpression | import("ts-morph").AsExpression | import("ts-morph").ComputedPropertyName | import("ts-morph").PropertyAssignment | import("ts-morph").ShorthandPropertyAssignment | import("ts-morph").PropertyAccessExpression<import("ts-morph").ts.PropertyAccessExpression> | import("ts-morph").NoSubstitutionTemplateLiteral | import("ts-morph").ExpressionStatement | import("ts-morph").TaggedTemplateExpression | import("ts-morph").ExportAssignment | import("ts-morph").ElementAccessExpression<import("ts-morph").ts.ElementAccessExpression> | import("ts-morph").TemplateExpression | import("ts-morph").ImportClause | import("ts-morph").ImportSpecifier | import("ts-morph").ImportDeclaration | import("ts-morph").NamedImports | import("ts-morph").VariableStatement | import("ts-morph").VariableDeclarationList | import("ts-morph").Node<import("ts-morph").ts.PlusToken> | import("ts-morph").Node<import("ts-morph").ts.ExportKeyword> | import("ts-morph").Node<import("ts-morph").ts.KeywordTypeNode<SyntaxKind.AnyKeyword>> | import("ts-morph").ModuleDeclaration | import("ts-morph").ModuleBlock | import("ts-morph").Block | import("ts-morph").ParameterDeclaration | import("ts-morph").Node<import("ts-morph").ts.EqualsGreaterThanToken> | import("ts-morph").ArrowFunction | import("ts-morph").TemplateHead | import("ts-morph").TemplateMiddle | import("ts-morph").TemplateSpan | import("ts-morph").TemplateTail | import("ts-morph").PrefixUnaryExpression;
|
|
168
|
+
guid: string;
|
|
169
|
+
data: {
|
|
170
|
+
$id: string | number;
|
|
171
|
+
data: globalThis.Record<string, any>;
|
|
172
|
+
table: string;
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
readonly xml: {
|
|
177
|
+
readonly record: (xml: XmlData<import("@servicenow/sdk-build-core").PrimitiveData>) => {
|
|
178
|
+
action: import("@servicenow/sdk-build-core").Action;
|
|
179
|
+
guid: string;
|
|
180
|
+
kind: string;
|
|
181
|
+
data: {
|
|
182
|
+
table: string;
|
|
183
|
+
data: string | number | boolean | import("@servicenow/sdk-build-core").PrimitiveData | import("@servicenow/sdk-build-core").PrimitiveData[] | undefined;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
readonly serializers: {
|
|
189
|
+
readonly record: (document: import("@servicenow/sdk-build-core").Document<"record"> & import("@servicenow/sdk-build-core").Arranged, context: Context) => {
|
|
190
|
+
name: `${string}_${string}.xml`;
|
|
191
|
+
directory: "update";
|
|
192
|
+
content: any;
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
readonly generators: {
|
|
196
|
+
readonly record: (document: import("@servicenow/sdk-build-core").UnlinkedDocument<"record"> & import("@servicenow/sdk-build-core").Arranged, context: Context) => import("@servicenow/sdk-build-core").LinkedDocument<"record", CallExpression<import("ts-morph").ts.CallExpression>>;
|
|
197
|
+
};
|
|
198
|
+
readonly transformers: {
|
|
199
|
+
readonly record: {
|
|
200
|
+
readonly CallExpression: (document: import("@servicenow/sdk-build-core").Document<any, CallExpression<import("ts-morph").ts.CallExpression>> & {
|
|
201
|
+
entity?: EntityData;
|
|
202
|
+
node: CallExpression<import("ts-morph").ts.CallExpression>;
|
|
203
|
+
} & import("@servicenow/sdk-build-core").Arranged) => boolean;
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
export declare function extractCallExpressionAsRecord<const A extends unknown[], const E extends A extends [infer T extends globalThis.Record<string, unknown>] ? T : never, const T extends TableName>(fn: (...args: A) => E, asRecord: (entity: E) => Record<T>, guid: (entity: E) => string, node: CallExpression, context: Context): ExtractionResult<EntityData<Record<T>>>;
|
|
208
|
+
export {};
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RecordPlugin = exports.RecordDocumentSchema = exports.RecordXmlSchema = exports.TextNumberSchema = exports.TextBooleanSchema = exports.TextStringSchema = exports.RecordEntitySchema = void 0;
|
|
4
|
+
exports.extractCallExpressionAsRecord = extractCallExpressionAsRecord;
|
|
5
|
+
const db_1 = require("@servicenow/sdk-core/runtime/db");
|
|
6
|
+
const sdk_build_core_1 = require("@servicenow/sdk-build-core");
|
|
7
|
+
const zod_1 = require("zod");
|
|
8
|
+
const ts_morph_1 = require("ts-morph");
|
|
9
|
+
// TODO: This schema should live with the Record entity function itself
|
|
10
|
+
exports.RecordEntitySchema = zod_1.z.object({
|
|
11
|
+
$id: zod_1.z.string().or(zod_1.z.number()),
|
|
12
|
+
data: zod_1.z.record(zod_1.z.any()),
|
|
13
|
+
table: zod_1.z.string(),
|
|
14
|
+
});
|
|
15
|
+
const RecordUpdate = zod_1.z.object({
|
|
16
|
+
record_update: zod_1.z.record(zod_1.z.any()),
|
|
17
|
+
});
|
|
18
|
+
const RecordUpdateTableSchema = zod_1.z.object({
|
|
19
|
+
'@_table': zod_1.z.string(),
|
|
20
|
+
});
|
|
21
|
+
exports.TextStringSchema = zod_1.z.object({ '#text': zod_1.z.string() }).transform((val) => val['#text']);
|
|
22
|
+
exports.TextBooleanSchema = zod_1.z.object({ '#text': zod_1.z.boolean() }).transform((val) => val['#text']);
|
|
23
|
+
exports.TextNumberSchema = zod_1.z.object({ '#text': zod_1.z.number().or(zod_1.z.literal('')) }).transform((val) => val['#text']);
|
|
24
|
+
const SysJournalFieldSchema = zod_1.z.object({
|
|
25
|
+
element: exports.TextStringSchema,
|
|
26
|
+
element_id: exports.TextStringSchema,
|
|
27
|
+
name: exports.TextStringSchema,
|
|
28
|
+
sys_id: exports.TextStringSchema,
|
|
29
|
+
value: exports.TextStringSchema,
|
|
30
|
+
});
|
|
31
|
+
const ignoreTables = ['sys_metadata_link', 'sys_module', 'sys_ux_lib_asset', 'sys_app', 'sys_store_app'];
|
|
32
|
+
const ignoreFields = [
|
|
33
|
+
'sys_created_by',
|
|
34
|
+
'sys_created_on',
|
|
35
|
+
'sys_updated_by',
|
|
36
|
+
'sys_updated_on',
|
|
37
|
+
'sys_mod_count',
|
|
38
|
+
'sys_class_name',
|
|
39
|
+
'sys_id',
|
|
40
|
+
'sys_package',
|
|
41
|
+
'sys_policy',
|
|
42
|
+
'sys_scope',
|
|
43
|
+
'sys_update_name',
|
|
44
|
+
];
|
|
45
|
+
const ignoreXMLElement = ['sys_translated_text', 'sys_es_latest_script'];
|
|
46
|
+
exports.RecordXmlSchema = zod_1.z
|
|
47
|
+
.object({
|
|
48
|
+
'@_action': zod_1.z.union([zod_1.z.literal('INSERT_OR_UPDATE'), zod_1.z.literal('DELETE'), zod_1.z.literal('delete_multiple')]),
|
|
49
|
+
sys_id: zod_1.z.object({
|
|
50
|
+
'#text': zod_1.z.string().min(32).max(32),
|
|
51
|
+
}),
|
|
52
|
+
})
|
|
53
|
+
.catchall(zod_1.z.intersection(zod_1.z.object({
|
|
54
|
+
'#text': zod_1.z.union([zod_1.z.string(), zod_1.z.boolean(), zod_1.z.number(), zod_1.z.undefined()]),
|
|
55
|
+
}), zod_1.z.record(zod_1.z.any()) // capture all attributes
|
|
56
|
+
));
|
|
57
|
+
exports.RecordDocumentSchema = zod_1.z.object({
|
|
58
|
+
data: zod_1.z.record(zod_1.z.union([zod_1.z.string(), zod_1.z.number(), zod_1.z.boolean(), zod_1.z.undefined(), zod_1.z.null()])),
|
|
59
|
+
table: zod_1.z.string(),
|
|
60
|
+
});
|
|
61
|
+
function cleanRecordUpdate(recordUpdate) {
|
|
62
|
+
ignoreXMLElement.forEach((element) => delete recordUpdate[element]);
|
|
63
|
+
return recordUpdate;
|
|
64
|
+
}
|
|
65
|
+
exports.RecordPlugin = (0, sdk_build_core_1.Plugin)({
|
|
66
|
+
name: 'Record',
|
|
67
|
+
extractors: {
|
|
68
|
+
entity: {
|
|
69
|
+
CallExpression: (node, context) => {
|
|
70
|
+
const result = (0, sdk_build_core_1.extractCallExpression)(db_1.Record, 'record', node, context, (record) => {
|
|
71
|
+
// Take the guid from the id property, a sys_id property, or generate one
|
|
72
|
+
if ('sys_id' in record.data) {
|
|
73
|
+
return record.data['sys_id'];
|
|
74
|
+
}
|
|
75
|
+
else if ((0, sdk_build_core_1.isGUID)(record.$id)) {
|
|
76
|
+
return record.$id;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
return context.keys.registerExplicitId(record.table, record.$id);
|
|
80
|
+
}
|
|
81
|
+
}, (record) => exports.RecordEntitySchema.safeParse(record).success);
|
|
82
|
+
if (!result.handled || !(0 in result.data)) {
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
const record = result.data[0];
|
|
86
|
+
const diagnostics = result.diagnostics;
|
|
87
|
+
const tableName = record.getProperty('table').getValue();
|
|
88
|
+
const pluginInfo = context.getPluginForTable(tableName);
|
|
89
|
+
if (pluginInfo) {
|
|
90
|
+
const { logLevel, api } = pluginInfo;
|
|
91
|
+
const tableNode = node
|
|
92
|
+
.getFirstChildByKindOrThrow(ts_morph_1.SyntaxKind.ObjectLiteralExpression)
|
|
93
|
+
.getPropertyOrThrow('table');
|
|
94
|
+
diagnostics.push(new sdk_build_core_1.FluentDiagnostic(tableNode, `${tableName} should not be created by the Record API. Please use the ${api} API.`, { level: logLevel }));
|
|
95
|
+
}
|
|
96
|
+
// TODO: Get this out of the RecordPlugin somehow. Maybe need to provide a new mechanism for
|
|
97
|
+
// plugins to add diagnostics for entities extracted by other plugins?
|
|
98
|
+
if (tableName === 'sys_ui_view') {
|
|
99
|
+
const viewName = record.getProperty('data').getProperty('name')?.getValue();
|
|
100
|
+
const viewDataNode = node
|
|
101
|
+
.getFirstChildByKindOrThrow(ts_morph_1.SyntaxKind.ObjectLiteralExpression)
|
|
102
|
+
.getPropertyOrThrow('data')
|
|
103
|
+
.asKindOrThrow(ts_morph_1.SyntaxKind.PropertyAssignment)
|
|
104
|
+
.getInitializerIfKind(ts_morph_1.SyntaxKind.ObjectLiteralExpression);
|
|
105
|
+
const viewNameNode = viewDataNode?.getPropertyOrThrow('name');
|
|
106
|
+
const nameRegex = new RegExp(`^[a-zA-Z0-9_]+$`);
|
|
107
|
+
if (typeof viewName !== 'string' || !viewName.match(nameRegex)) {
|
|
108
|
+
diagnostics.push(new sdk_build_core_1.FluentDiagnostic(viewNameNode, `View name can only contain alphanumeric characters`));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
handled: true,
|
|
113
|
+
diagnostics,
|
|
114
|
+
data: [record],
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
xml(xml, context) {
|
|
119
|
+
// Parse out record_Update info
|
|
120
|
+
const recordUpdateResult = RecordUpdate.safeParse(xml.data);
|
|
121
|
+
if (!recordUpdateResult.success) {
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
// Parse root level @_table from record_update
|
|
125
|
+
const recordUpdate = cleanRecordUpdate(recordUpdateResult.data.record_update);
|
|
126
|
+
let tableRecord, recordTable;
|
|
127
|
+
const table = RecordUpdateTableSchema.safeParse(recordUpdate);
|
|
128
|
+
if (!table.success) {
|
|
129
|
+
// TODO A record plugin should only handle 1 table record?
|
|
130
|
+
// Taking the first one for now. Shouldn't assume this is the right one
|
|
131
|
+
recordTable = Object.keys(recordUpdate)[0];
|
|
132
|
+
tableRecord = recordUpdate[recordTable];
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
recordTable = table.data['@_table'];
|
|
136
|
+
tableRecord = recordUpdate[table.data['@_table']];
|
|
137
|
+
}
|
|
138
|
+
const ignoreTableList = [...context.app.config.ignoreTransformTableList, ...ignoreTables];
|
|
139
|
+
if (!tableRecord || ignoreTableList.includes(recordTable)) {
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
const recordParse = exports.RecordXmlSchema.safeParse(tableRecord);
|
|
143
|
+
if (!recordParse.success) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
if (tableRecord['@_action'] !== 'DELETE' &&
|
|
147
|
+
Object.keys(recordUpdate).some((k) => k !== recordTable && !k.startsWith('@_'))) {
|
|
148
|
+
// Record contains other entries in the file that cannot be processed
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
try {
|
|
152
|
+
const { '@_action': action, sys_id: { '#text': sysId }, ...rest } = tableRecord;
|
|
153
|
+
const record = Object.entries(rest).reduce((out, [k, v]) => {
|
|
154
|
+
out[k] = v ? v['#text'] : undefined;
|
|
155
|
+
return out;
|
|
156
|
+
}, {});
|
|
157
|
+
return new sdk_build_core_1.XmlData({
|
|
158
|
+
id: sysId,
|
|
159
|
+
table: recordTable,
|
|
160
|
+
data: record,
|
|
161
|
+
}, xml.filePath, 'record', action);
|
|
162
|
+
}
|
|
163
|
+
catch (err) {
|
|
164
|
+
return undefined; // TODO: What are we catching here?
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
composers: {
|
|
169
|
+
entity: {
|
|
170
|
+
record(entity, context) {
|
|
171
|
+
const { $id, ...record } = exports.RecordEntitySchema.parse(entity.getValue());
|
|
172
|
+
const fixedData = Object.entries(record.data).reduce((out, [c, v]) => {
|
|
173
|
+
if (!v || typeof v !== 'object') {
|
|
174
|
+
out[c] = v;
|
|
175
|
+
return out;
|
|
176
|
+
}
|
|
177
|
+
const record = exports.RecordEntitySchema.safeParse(v);
|
|
178
|
+
if (record.success) {
|
|
179
|
+
// User can override hashing w/ explicit sys_id
|
|
180
|
+
if ('sys_id' in record.data.data) {
|
|
181
|
+
out[c] = record.data.data['sys_id'];
|
|
182
|
+
}
|
|
183
|
+
else if ((0, sdk_build_core_1.isGUID)(record.data.$id)) {
|
|
184
|
+
out[c] = record.data.$id;
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
out[c] = context.keys.registerExplicitId(record.data.table, record.data.$id);
|
|
188
|
+
}
|
|
189
|
+
return out;
|
|
190
|
+
}
|
|
191
|
+
throw Error(`Unknown object assigned to '${c}' column: ${JSON.stringify(v, undefined, 4)}`);
|
|
192
|
+
}, {});
|
|
193
|
+
const data = {
|
|
194
|
+
table: record.table,
|
|
195
|
+
$id, //preserve the original id if set
|
|
196
|
+
data: fixedData,
|
|
197
|
+
};
|
|
198
|
+
return {
|
|
199
|
+
kind: 'record',
|
|
200
|
+
node: entity.getNode(),
|
|
201
|
+
guid: entity.getGuid(),
|
|
202
|
+
data,
|
|
203
|
+
};
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
xml: {
|
|
207
|
+
record(xml) {
|
|
208
|
+
const table = xml.data['table'];
|
|
209
|
+
const sysId = xml.data['id'];
|
|
210
|
+
return {
|
|
211
|
+
action: xml.action,
|
|
212
|
+
guid: sysId,
|
|
213
|
+
kind: 'record',
|
|
214
|
+
data: { table, data: xml.data['data'] },
|
|
215
|
+
};
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
serializers: {
|
|
220
|
+
record(document, context) {
|
|
221
|
+
const { table, data } = exports.RecordDocumentSchema.parse(document.data);
|
|
222
|
+
const recordBuilder = (0, sdk_build_core_1.unloadBuilder)(context);
|
|
223
|
+
const builder = recordBuilder.record(table, document.guid, document.action);
|
|
224
|
+
Object.entries(data)
|
|
225
|
+
.filter(([c, v]) => typeof v !== 'undefined' && c !== 'sys_id')
|
|
226
|
+
.forEach(([c, v]) => builder.field(c, v));
|
|
227
|
+
return {
|
|
228
|
+
name: `${table}_${document.guid}.xml`,
|
|
229
|
+
directory: 'update',
|
|
230
|
+
content: recordBuilder.end(),
|
|
231
|
+
};
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
generators: {
|
|
235
|
+
record(document, context) {
|
|
236
|
+
return (0, sdk_build_core_1.linkDocument)(document, (0, sdk_build_core_1.generateCallExpressionExportForDocument)(context, {
|
|
237
|
+
sourceFile: (0, sdk_build_core_1.getOrCreateEntitySourceFile)(context, `${document.data?.['table']}_${document.guid}`),
|
|
238
|
+
moduleSpecifier: '@servicenow/sdk/core',
|
|
239
|
+
}, db_1.Record, { $id: document.guid }).getExpressionIfKindOrThrow(ts_morph_1.SyntaxKind.CallExpression));
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
transformers: {
|
|
243
|
+
record: {
|
|
244
|
+
CallExpression(document) {
|
|
245
|
+
if ((0, sdk_build_core_1.getCallExpressionName)(document.node) !== db_1.Record.name) {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
if (document.action === 'DELETE') {
|
|
249
|
+
(0, sdk_build_core_1.removeNode)(document.node);
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
if (!document.changedData) {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
const { table } = document.data;
|
|
256
|
+
const data = document.changedData.data;
|
|
257
|
+
const properties = Object.keys(data).reduce((out, key) => {
|
|
258
|
+
if (ignoreFields.includes(key)) {
|
|
259
|
+
return out;
|
|
260
|
+
}
|
|
261
|
+
if (data[key] !== '' && data[key] !== undefined) {
|
|
262
|
+
out[key] = data[key];
|
|
263
|
+
}
|
|
264
|
+
return out;
|
|
265
|
+
}, {});
|
|
266
|
+
(0, sdk_build_core_1.transformFunctionArguments)(document.node, db_1.Record, {
|
|
267
|
+
table,
|
|
268
|
+
data: properties,
|
|
269
|
+
});
|
|
270
|
+
return true;
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
});
|
|
275
|
+
function extractCallExpressionAsRecord(fn, asRecord, guid, node, context) {
|
|
276
|
+
const result = (0, sdk_build_core_1.extractCallExpression)(fn, 'record', node, context, guid);
|
|
277
|
+
if (!result.handled) {
|
|
278
|
+
return result;
|
|
279
|
+
}
|
|
280
|
+
return {
|
|
281
|
+
handled: true,
|
|
282
|
+
diagnostics: result.diagnostics,
|
|
283
|
+
// data: result.data.map((d) => new EntityData(context, node, 'record', d.guid, asRecord(d.data))),
|
|
284
|
+
data: result.data.map((d) => new sdk_build_core_1.EntityData('record', d.getGuid(), sdk_build_core_1.ObjectData.fromObjectValue(asRecord(d.getValue()), node), node)),
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=RecordPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecordPlugin.js","sourceRoot":"","sources":["../../src/db/RecordPlugin.ts"],"names":[],"mappings":";;;AA8WA,sEAwBC;AAtYD,wDAAmE;AACnE,+DAiBmC;AACnC,6BAAuB;AACvB,uCAAqD;AAErD,uEAAuE;AAC1D,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;IAC9B,IAAI,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,GAAG,EAAE,CAAC;IACvB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAA;AAKF,MAAM,YAAY,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1B,aAAa,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,GAAG,EAAE,CAAC;CACnC,CAAC,CAAA;AAEF,MAAM,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;CACxB,CAAC,CAAA;AAEW,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,SAAS,C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