@autofleet/sadot 0.5.4-beta.20 → 0.5.4-beta.21
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/hooks/create.d.ts +1 -1
- package/dist/hooks/create.js +1 -1
- package/dist/hooks/enrich.js +1 -1
- package/dist/hooks/update.d.ts +1 -1
- package/dist/hooks/update.js +1 -1
- package/package.json +1 -1
- package/src/hooks/create.ts +1 -1
- package/src/hooks/enrich.ts +1 -1
- package/src/hooks/update.ts +1 -1
- package/src/types/index.ts +1 -1
package/dist/hooks/create.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ export declare const beforeBulkCreate: (options: any) => void;
|
|
|
7
7
|
* A hook to create the custom fields when updating a model instance.
|
|
8
8
|
* TODO - cleanup if update fail
|
|
9
9
|
*/
|
|
10
|
-
export declare const beforeCreate: (scopeAttributes: string[], modelOptions
|
|
10
|
+
export declare const beforeCreate: (scopeAttributes: string[], modelOptions?: ModelOptions) => (instance: any, options: any) => Promise<void>;
|
package/dist/hooks/create.js
CHANGED
|
@@ -44,7 +44,7 @@ exports.beforeBulkCreate = beforeBulkCreate;
|
|
|
44
44
|
* A hook to create the custom fields when updating a model instance.
|
|
45
45
|
* TODO - cleanup if update fail
|
|
46
46
|
*/
|
|
47
|
-
const beforeCreate = (scopeAttributes, modelOptions) => async (instance, options) => {
|
|
47
|
+
const beforeCreate = (scopeAttributes, modelOptions = {}) => async (instance, options) => {
|
|
48
48
|
const { fields } = options;
|
|
49
49
|
const modelType = instance.constructor.name;
|
|
50
50
|
const { scopeAttributeReplacer } = modelOptions;
|
package/dist/hooks/enrich.js
CHANGED
|
@@ -45,7 +45,7 @@ const serializeCustomFields = (customFieldValues, customFieldDefinitionsHash) =>
|
|
|
45
45
|
/**
|
|
46
46
|
* A hook to attach the custom fields when fetching a model instances.
|
|
47
47
|
*/
|
|
48
|
-
const enrichResults = (modelType, scopeAttributes, getScope, hookType, modelOptions) => async (instancesOrInstance, options) => {
|
|
48
|
+
const enrichResults = (modelType, scopeAttributes, getScope, hookType, modelOptions = {}) => async (instancesOrInstance, options) => {
|
|
49
49
|
const { scopeAttributeReplacer } = modelOptions;
|
|
50
50
|
if (options.originalAttributes?.length > 0
|
|
51
51
|
&& !options.originalAttributes?.includes?.('customFields')) {
|
package/dist/hooks/update.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ export declare const beforeBulkUpdate: (options: any) => void;
|
|
|
7
7
|
* A hook to update the custom fields when updating a model instance.
|
|
8
8
|
* TODO - cleanup if update fail
|
|
9
9
|
*/
|
|
10
|
-
export declare const beforeUpdate: (scopeAttributes: string[], modelOptions
|
|
10
|
+
export declare const beforeUpdate: (scopeAttributes: string[], modelOptions?: ModelOptions) => (instance: any, options: any) => Promise<void>;
|
package/dist/hooks/update.js
CHANGED
|
@@ -43,7 +43,7 @@ exports.beforeBulkUpdate = beforeBulkUpdate;
|
|
|
43
43
|
* A hook to update the custom fields when updating a model instance.
|
|
44
44
|
* TODO - cleanup if update fail
|
|
45
45
|
*/
|
|
46
|
-
const beforeUpdate = (scopeAttributes, modelOptions) => async (instance, options) => {
|
|
46
|
+
const beforeUpdate = (scopeAttributes, modelOptions = {}) => async (instance, options) => {
|
|
47
47
|
logger_1.default.debug('sadot - before update hook');
|
|
48
48
|
const { fields } = options;
|
|
49
49
|
const { scopeAttributeReplacer } = modelOptions;
|
package/package.json
CHANGED
package/src/hooks/create.ts
CHANGED
|
@@ -16,7 +16,7 @@ export const beforeBulkCreate = (options): void => {
|
|
|
16
16
|
* A hook to create the custom fields when updating a model instance.
|
|
17
17
|
* TODO - cleanup if update fail
|
|
18
18
|
*/
|
|
19
|
-
export const beforeCreate = (scopeAttributes: string[], modelOptions: ModelOptions) => async (
|
|
19
|
+
export const beforeCreate = (scopeAttributes: string[], modelOptions: ModelOptions = {}) => async (
|
|
20
20
|
instance,
|
|
21
21
|
options,
|
|
22
22
|
): Promise<void> => {
|
package/src/hooks/enrich.ts
CHANGED
package/src/hooks/update.ts
CHANGED
|
@@ -16,7 +16,7 @@ export const beforeBulkUpdate = (options): void => {
|
|
|
16
16
|
* A hook to update the custom fields when updating a model instance.
|
|
17
17
|
* TODO - cleanup if update fail
|
|
18
18
|
*/
|
|
19
|
-
export const beforeUpdate = (scopeAttributes: string[], modelOptions: ModelOptions) => async (
|
|
19
|
+
export const beforeUpdate = (scopeAttributes: string[], modelOptions: ModelOptions = {}) => async (
|
|
20
20
|
instance,
|
|
21
21
|
options,
|
|
22
22
|
): Promise<void> => {
|
package/src/types/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type ModelOptions = {
|
|
|
6
6
|
export type Models = {
|
|
7
7
|
name: string;
|
|
8
8
|
scopeAttributes: string[];
|
|
9
|
-
modelOptions?: ModelOptions
|
|
9
|
+
modelOptions?: ModelOptions;
|
|
10
10
|
creationWebhookHandler?: (instance: any) => any;
|
|
11
11
|
updateWebhookHandler?: (instance: any) => any;
|
|
12
12
|
deletionWebhookHandler?: (instance: any) => any;
|