Skip to content

Commit

Permalink
chore: awaitCreateComplete can pass get parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurin-W committed Sep 30, 2023
1 parent ad368c5 commit 68c27f4
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { MIME_TYPES } = require('@semapps/mime-types');
const { waitForResource } = require('../../../utils');

/** @type {import('moleculer').ServiceActionsSchema} */
Expand All @@ -7,10 +8,21 @@ module.exports = {
resourceUri: { type: 'string' },
predicates: { type: 'array', optional: true },
delayMs: { type: 'number', optional: true },
maxTries: { type: 'number', optional: true }
maxTries: { type: 'number', optional: true },

// Optional get-action parameters
webId: { type: 'string', optional: true },
dereference: { type: 'array', optional: true },
jsonContext: {
type: 'multi',
rules: [{ type: 'array' }, { type: 'object' }, { type: 'string' }],
optional: true
},
forceSemantic: { type: 'boolean', optional: true },
aclVerified: { type: 'boolean', optional: true }
},
async handler(ctx) {
const { resourceUri, predicates = [], delayMs = 1000, maxTries = 30 } = ctx.params;
const { resourceUri, predicates = [], delayMs = 1000, maxTries = 30, webId = 'system', ...rest } = ctx.params;

return await waitForResource(
delayMs,
Expand All @@ -22,7 +34,7 @@ module.exports = {
{
resourceUri: resourceUri,
accept: MIME_TYPES.JSON,
webId: 'system'
...rest
},
{ meta: { $cache: false } }
))
Expand Down

0 comments on commit 68c27f4

Please sign in to comment.