http-sankhya 1.0.2 → 1.0.3
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 +6 -4
- package/dist/Sankhya.d.ts +2 -1
- package/dist/Sankhya.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -138,16 +138,18 @@ const novoGrupo = await sankhya.saveRecord({
|
|
|
138
138
|
});
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
#### Atualizar Registro Existente
|
|
142
|
-
Para atualizar,
|
|
141
|
+
#### Atualizar Registro Existente
|
|
142
|
+
Para atualizar um registro existente, você deve fornecer a propriedade `key` contendo a chave primária do registro. Isso instrui o Sankhya a realizar um update na linha específica.
|
|
143
143
|
|
|
144
144
|
```typescript
|
|
145
145
|
const atualizacao = await sankhya.saveRecord({
|
|
146
146
|
rootEntity: 'GrupoProduto',
|
|
147
147
|
localFields: {
|
|
148
|
-
|
|
149
|
-
DESCRGRUPOPROD: "NOME ATUALIZADO", // Campo a alterar
|
|
148
|
+
DESCRGRUPOPROD: "NOME ATUALIZADO", // Campos a alterar
|
|
150
149
|
ATIVO: "N"
|
|
150
|
+
},
|
|
151
|
+
key: {
|
|
152
|
+
CODGRUPOPROD: "20310006" // Chave Primária (PK) para identificação do registro
|
|
151
153
|
}
|
|
152
154
|
});
|
|
153
155
|
```
|
package/dist/Sankhya.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export interface SaveRecordOptions {
|
|
|
16
16
|
rootEntity: string;
|
|
17
17
|
includePresentationFields?: 'S' | 'N';
|
|
18
18
|
localFields?: Record<string, any>;
|
|
19
|
+
key?: Record<string, any>;
|
|
19
20
|
entity?: Record<string, any>;
|
|
20
21
|
}
|
|
21
22
|
export interface ExecServiceOptions {
|
|
@@ -42,6 +43,6 @@ export declare class Sankhya {
|
|
|
42
43
|
execService(options: ExecServiceOptions, outputType?: 'json' | 'xml'): Promise<any>;
|
|
43
44
|
loadRecords({ rootEntity, includePresentationFields, offsetPage, criteria, entity }: LoadRecordsOptions, outputType?: 'json' | 'xml'): Promise<any>;
|
|
44
45
|
loadRecord({ rootEntity, includePresentationFields, criteria, entity, rows }: LoadRecordsOptions, outputType?: 'json' | 'xml'): Promise<any>;
|
|
45
|
-
saveRecord({ rootEntity, includePresentationFields, localFields, entity }: SaveRecordOptions, outputType?: 'json' | 'xml'): Promise<any>;
|
|
46
|
+
saveRecord({ rootEntity, includePresentationFields, localFields, key, entity }: SaveRecordOptions, outputType?: 'json' | 'xml'): Promise<any>;
|
|
46
47
|
private isEmptyObject;
|
|
47
48
|
}
|
package/dist/Sankhya.js
CHANGED
|
@@ -139,7 +139,7 @@ class Sankhya {
|
|
|
139
139
|
outputType
|
|
140
140
|
}, outputType);
|
|
141
141
|
}
|
|
142
|
-
async saveRecord({ rootEntity, includePresentationFields = 'N', localFields = {}, entity = {} }, outputType = 'json') {
|
|
142
|
+
async saveRecord({ rootEntity, includePresentationFields = 'N', localFields = {}, key = {}, entity = {} }, outputType = 'json') {
|
|
143
143
|
return this.execService({
|
|
144
144
|
serviceName: 'CRUDServiceProvider.saveRecord',
|
|
145
145
|
requestBody: {
|
|
@@ -147,7 +147,8 @@ class Sankhya {
|
|
|
147
147
|
rootEntity,
|
|
148
148
|
includePresentationFields,
|
|
149
149
|
dataRow: {
|
|
150
|
-
localFields: SankhyaHelper_1.SankhyaHelper.transformLocalFields(localFields)
|
|
150
|
+
localFields: SankhyaHelper_1.SankhyaHelper.transformLocalFields(localFields),
|
|
151
|
+
key: SankhyaHelper_1.SankhyaHelper.transformLocalFields(key)
|
|
151
152
|
},
|
|
152
153
|
entity
|
|
153
154
|
}
|