@things-factory/biz-base 10.1.134 → 10.1.135

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.
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CounterpartyMutation = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const type_graphql_1 = require("type-graphql");
6
+ const shell_1 = require("@things-factory/shell");
6
7
  const counterparty_1 = require("./counterparty");
7
8
  const counterparty_service_1 = require("./counterparty-service");
8
9
  const counterparty_type_1 = require("./counterparty-type");
@@ -52,7 +53,9 @@ tslib_1.__decorate([
52
53
  tslib_1.__decorate([
53
54
  (0, type_graphql_1.Directive)('@transaction'),
54
55
  (0, type_graphql_1.Directive)('@privilege(category: "counterparty", privilege: "mutation", domainOwnerGranted: true)'),
55
- (0, type_graphql_1.Mutation)(returns => [counterparty_1.Counterparty], { description: 'To save the counterparty grid - new, changed and deleted rows together' }),
56
+ (0, type_graphql_1.Mutation)(returns => [counterparty_1.Counterparty], {
57
+ description: 'To save the counterparty grid - new, changed and deleted rows together'
58
+ }),
56
59
  tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [counterparty_type_1.CounterpartyPatch])),
57
60
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
58
61
  tslib_1.__metadata("design:type", Function),
@@ -62,7 +65,9 @@ tslib_1.__decorate([
62
65
  tslib_1.__decorate([
63
66
  (0, type_graphql_1.Directive)('@transaction'),
64
67
  (0, type_graphql_1.Directive)('@privilege(category: "counterparty", privilege: "mutation", domainOwnerGranted: true)'),
65
- (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete counterparties - the rows that name them keep the name and lose the link' }),
68
+ (0, type_graphql_1.Mutation)(returns => Boolean, {
69
+ description: 'To delete counterparties - the rows that name them keep the name and lose the link'
70
+ }),
66
71
  tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
67
72
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
68
73
  tslib_1.__metadata("design:type", Function),
@@ -70,6 +75,7 @@ tslib_1.__decorate([
70
75
  tslib_1.__metadata("design:returntype", Promise)
71
76
  ], CounterpartyMutation.prototype, "deleteCounterparties", null);
72
77
  exports.CounterpartyMutation = CounterpartyMutation = tslib_1.__decorate([
73
- (0, type_graphql_1.Resolver)(counterparty_1.Counterparty)
78
+ (0, type_graphql_1.Resolver)(counterparty_1.Counterparty),
79
+ (0, type_graphql_1.UseMiddleware)(shell_1.SpeakRefusals)
74
80
  ], CounterpartyMutation);
75
81
  //# sourceMappingURL=counterparty-mutation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"counterparty-mutation.js","sourceRoot":"","sources":["../../../server/service/counterparty/counterparty-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AAEtE,iDAA6C;AAC7C,iEAA2D;AAC3D,2DAAwE;AAGjE,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAIzB,AAAN,KAAK,CAAC,kBAAkB,CAAsB,KAAsB,EAAS,OAAwB;QACnG,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1C,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,IAAA,yCAAkB,EAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAA;QACvF,OAAO,KAAK,CAAA;IACd,CAAC;IAKK,AAAN,KAAK,CAAC,kBAAkB,CAAY,EAAU,EAAgB,KAAwB,EAAS,OAAwB;QACrH,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1C,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,IAAA,yCAAkB,EAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,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AAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,EAAC,OAAO,CAAC,CAAA;IAA4B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;qDAAzB,qCAAiB;;8DAIrF;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,uFAAuF,CAAC;IAClG,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC,2BAAY,CAAC,EAAE,EAAE,WAAW,EAAE,wEAAwE,EAAE,CAAC;IAC7F,mBAAA,IAAA,kBAAG,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,qCAAiB,CAAC,CAAC,CAAA;IAAgC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;sEAGjH;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,uFAAuF,CAAC;IAClG,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,oFAAoF,EAAE,CAAC;IACxG,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAAiB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;gEAI7E;+BAlCU,oBAAoB;IADhC,IAAA,uBAAQ,EAAC,2BAAY,CAAC;GACV,oBAAoB,CAmChC","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\n\nimport { Counterparty } from './counterparty'\nimport { saveCounterparties } from './counterparty-service'\nimport { CounterpartyPatch, NewCounterparty } from './counterparty-type'\n\n@Resolver(Counterparty)\nexport class CounterpartyMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"counterparty\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Counterparty, { description: 'To register a counterparty' })\n async createCounterparty(@Arg('counterparty') input: NewCounterparty, @Ctx() context: ResolverContext): Promise<Counterparty> {\n const { tx, domain, user } = context.state\n const [saved] = await saveCounterparties(tx, domain, user, [{ ...input, cuFlag: '+' }])\n return saved\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"counterparty\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Counterparty, { description: 'To change a counterparty' })\n async updateCounterparty(@Arg('id') id: string, @Arg('patch') patch: CounterpartyPatch, @Ctx() context: ResolverContext): Promise<Counterparty> {\n const { tx, domain, user } = context.state\n const [saved] = await saveCounterparties(tx, domain, user, [{ ...patch, id, cuFlag: 'M' }])\n return saved\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"counterparty\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => [Counterparty], { description: 'To save the counterparty grid - new, changed and deleted rows together' })\n async updateMultipleCounterparty(@Arg('patches', type => [CounterpartyPatch]) patches: CounterpartyPatch[], @Ctx() context: ResolverContext): Promise<Counterparty[]> {\n const { tx, domain, user } = context.state\n return await saveCounterparties(tx, domain, user, patches)\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"counterparty\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete counterparties - the rows that name them keep the name and lose the link' })\n async deleteCounterparties(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n const { tx, domain, user } = context.state\n await saveCounterparties(tx, domain, user, ids.map(id => ({ id, cuFlag: '-' })))\n return true\n }\n}\n"]}
1
+ {"version":3,"file":"counterparty-mutation.js","sourceRoot":"","sources":["../../../server/service/counterparty/counterparty-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAqF;AAErF,iDAAqD;AAErD,iDAA6C;AAC7C,iEAA2D;AAC3D,2DAAwE;AAIjE,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAIzB,AAAN,KAAK,CAAC,kBAAkB,CACD,KAAsB,EACpC,OAAwB;QAE/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E,oFAAoF;KAClG,CAAC;IAEC,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;gEAUP;+BAxDU,oBAAoB;IAFhC,IAAA,uBAAQ,EAAC,2BAAY,CAAC;IACtB,IAAA,4BAAa,EAAC,qBAAa,CAAC;GAChB,oBAAoB,CAyDhC","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver, UseMiddleware } from 'type-graphql'\n\nimport { SpeakRefusals } from '@things-factory/shell'\n\nimport { Counterparty } from './counterparty'\nimport { saveCounterparties } from './counterparty-service'\nimport { CounterpartyPatch, NewCounterparty } from './counterparty-type'\n\n@Resolver(Counterparty)\n@UseMiddleware(SpeakRefusals)\nexport class CounterpartyMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"counterparty\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Counterparty, { description: 'To register a counterparty' })\n async createCounterparty(\n @Arg('counterparty') input: NewCounterparty,\n @Ctx() context: ResolverContext\n ): Promise<Counterparty> {\n const { tx, domain, user } = context.state\n const [saved] = await saveCounterparties(tx, domain, user, [{ ...input, cuFlag: '+' }])\n return saved\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"counterparty\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Counterparty, { description: 'To change a counterparty' })\n async updateCounterparty(\n @Arg('id') id: string,\n @Arg('patch') patch: CounterpartyPatch,\n @Ctx() context: ResolverContext\n ): Promise<Counterparty> {\n const { tx, domain, user } = context.state\n const [saved] = await saveCounterparties(tx, domain, user, [{ ...patch, id, cuFlag: 'M' }])\n return saved\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"counterparty\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => [Counterparty], {\n description: 'To save the counterparty grid - new, changed and deleted rows together'\n })\n async updateMultipleCounterparty(\n @Arg('patches', type => [CounterpartyPatch]) patches: CounterpartyPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Counterparty[]> {\n const { tx, domain, user } = context.state\n return await saveCounterparties(tx, domain, user, patches)\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"counterparty\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, {\n description: 'To delete counterparties - the rows that name them keep the name and lose the link'\n })\n async deleteCounterparties(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { tx, domain, user } = context.state\n await saveCounterparties(\n tx,\n domain,\n user,\n ids.map(id => ({ id, cuFlag: '-' }))\n )\n return true\n }\n}\n"]}