integreat 1.5.0-rc.3 → 1.5.0

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.
Files changed (58) hide show
  1. package/README.md +271 -22
  2. package/dist/Instance.js +5 -4
  3. package/dist/Instance.js.map +1 -1
  4. package/dist/authenticators/options.js +7 -6
  5. package/dist/authenticators/options.js.map +1 -1
  6. package/dist/dispatchScheduled.d.ts +1 -1
  7. package/dist/dispatchScheduled.js +5 -1
  8. package/dist/dispatchScheduled.js.map +1 -1
  9. package/dist/handlers/expire.js +30 -27
  10. package/dist/handlers/expire.js.map +1 -1
  11. package/dist/handlers/getIdent.js +22 -15
  12. package/dist/handlers/getIdent.js.map +1 -1
  13. package/dist/index.d.ts +5 -4
  14. package/dist/index.js +1 -0
  15. package/dist/index.js.map +1 -1
  16. package/dist/jobs/Job.d.ts +1 -1
  17. package/dist/jobs/Job.js +3 -3
  18. package/dist/jobs/Job.js.map +1 -1
  19. package/dist/jobs/Step.d.ts +1 -1
  20. package/dist/jobs/Step.js +85 -29
  21. package/dist/jobs/Step.js.map +1 -1
  22. package/dist/jobs/types.d.ts +1 -0
  23. package/dist/middleware/completeIdent.js +5 -6
  24. package/dist/middleware/completeIdent.js.map +1 -1
  25. package/dist/service/Endpoint.js +2 -2
  26. package/dist/service/Endpoint.js.map +1 -1
  27. package/dist/service/Service.js +2 -2
  28. package/dist/service/Service.js.map +1 -1
  29. package/dist/service/types.d.ts +6 -5
  30. package/dist/service/utils/authData.d.ts +1 -1
  31. package/dist/service/utils/authData.js +16 -16
  32. package/dist/service/utils/authData.js.map +1 -1
  33. package/dist/service/utils/matchEnpoints.js +2 -4
  34. package/dist/service/utils/matchEnpoints.js.map +1 -1
  35. package/dist/types.d.ts +6 -0
  36. package/dist/types.js +1 -0
  37. package/dist/types.js.map +1 -1
  38. package/dist/utils/createMapOptions.d.ts +1 -1
  39. package/dist/utils/createMapOptions.js +2 -2
  40. package/dist/utils/createMapOptions.js.map +1 -1
  41. package/dist/utils/getField.d.ts +1 -1
  42. package/dist/utils/getField.js +5 -2
  43. package/dist/utils/getField.js.map +1 -1
  44. package/dist/utils/is.d.ts +3 -0
  45. package/dist/utils/is.js +4 -0
  46. package/dist/utils/is.js.map +1 -1
  47. package/dist/utils/response.js +7 -7
  48. package/dist/utils/response.js.map +1 -1
  49. package/dist/utils/validateFilters.d.ts +1 -1
  50. package/dist/utils/validateFilters.js +8 -6
  51. package/dist/utils/validateFilters.js.map +1 -1
  52. package/dist/utils/validation.d.ts +1 -1
  53. package/dist/utils/validation.js +5 -5
  54. package/dist/utils/validation.js.map +1 -1
  55. package/dist/utils/xor.d.ts +1 -0
  56. package/dist/utils/xor.js +4 -0
  57. package/dist/utils/xor.js.map +1 -0
  58. package/package.json +5 -5
package/README.md CHANGED
@@ -365,8 +365,10 @@ specify a few things:
365
365
  will not by cast automatically nor will an error be returned if the data is
366
366
  not typed.
367
367
  - `allowRawResponse`: When set to `true`, response `data` coming from this
368
- endpoint will not by cast automatically nor will an error be returned if the
369
- data is not typed.
368
+ endpoint will not be cast automatically nor will an error be returned if the
369
+ data is not typed. The default is `false`, expcept for incoming endpoints
370
+ (endpoints where `match` object has `incoming: true`) where the default value
371
+ is `true`.
370
372
  - `castWithoutDefaults`: Set to `true` when you don't want to set default values
371
373
  on casted data. This also means no `id` will be generated and no `createdAt`
372
374
  or `updatedAt` will be set – when any of these are missing in the data.
@@ -829,6 +831,25 @@ A double carret `^^` takes you to the top -- the root -- so after
829
831
  Carret notations -- parents and roots -- does not currently work in reverse, but
830
832
  they might in a future version.
831
833
 
834
+ ### Non-values
835
+
836
+ The behavior of some transformers are based upon certain values being
837
+ non-values. E.g. `{ $alt: [<pipeline 1>, <pipeline 2>] }` will use the value
838
+ from the first pipeline if it returns a value, otherwise the value from the
839
+ second pipeline, meaning it will check for non-values. By default `null`,
840
+ `undefined`, and `''` (empty string) are non-values. By setting the `nonvalues`
841
+ param to an array of values in the defintions object you pass to
842
+ `Integreat.create()`, you may specify your own non-values.
843
+
844
+ If you don't want empty string to a non-value, for instance, you do this:
845
+
846
+ ```javascript
847
+ const great = Integreat.create({
848
+ nonvalues: [null, undefined],
849
+ // ... other definitions
850
+ })
851
+ ```
852
+
832
853
  ## Schemas
833
854
 
834
855
  A central idea to Integreat, is that any integration has two sides; the getting
@@ -1431,12 +1452,12 @@ Example ident:
1431
1452
  setting the auth rules for a schema, you specify required rules so that to get
1432
1453
  data cast in this schema, an ident with e.g. the role `admin` must be
1433
1454
  provided.
1434
- - `type`: An optional string to signal when this ident is `'ROOT'` or `'ANON'`.
1435
- This is used internally by Integreat, but in some cases you may want to set
1436
- this yourself. Make sure, however, that you don't let third-parties set
1437
- `'ROOT'`. Make sure to also set the id, typically to `'root'` or
1438
- `'anonymous'`. Not setting any `type` is the same as setting it to `'CUST'`,
1439
- which is the default.
1455
+ - `type`: An optional string to signal when this ident is `'ROOT'`, `'SCHED'`,
1456
+ or `'ANON'`. This is used internally by Integreat, but in some cases you may
1457
+ want to set this yourself. Make sure, however, that you don't let
1458
+ third-parties set `'ROOT'`. Make sure to also set the id, typically to
1459
+ `'root'` or `'anonymous'`. Not setting any `type` is the same as setting it to
1460
+ `'CUST'`, which is the default.
1440
1461
  - `isCompleted`: A flag to signal that an ident has already been completed, so
1441
1462
  that it won't be completed again. Used by the `completeIdent` middleware. You
1442
1463
  should normally not need to set this yourself.
@@ -1775,13 +1796,15 @@ it won't be wrapped in an array.)
1775
1796
 
1776
1797
  #### `EXPIRE`
1777
1798
 
1778
- > [!NOTE]
1779
- > This action will change before we reach v1.0.
1799
+ The `EXPIRE` action have two alternative way of operating. If the
1800
+ `deleteWithParams` param is `false` or not set, we will first dispatch a `GET`
1801
+ action to fetch expired data items from a service, and the then dispatch a
1802
+ `DELETE` action with the retrieved data items. If `deleteWithParams` is `true`,
1803
+ we will instead dispatch a `DELETE` action right away with the same params we
1804
+ would have provided to the `GET` action.
1780
1805
 
1781
- The `EXPIRE` action will `GET` expired data items from a service, and the then
1782
- `DELETE` them.
1783
-
1784
- Here's an example of an `EXPIRE` action:
1806
+ Here's an example of an `EXPIRE` action that will dispatch a `GET` and a
1807
+ `DELETE`:
1785
1808
 
1786
1809
  ```javascript
1787
1810
  {
@@ -1790,16 +1813,28 @@ Here's an example of an `EXPIRE` action:
1790
1813
  service: 'store',
1791
1814
  type: 'entry',
1792
1815
  endpoint: 'getExpired',
1793
- msFromNow: 0
1816
+ msFromNow: -24 * 60 * 60 * 1000 // Delete entries older than 24 hours
1794
1817
  }
1795
1818
  }
1796
1819
  ```
1797
1820
 
1798
- The `endpoint` property is required for this action, and needs to specify a
1799
- service endpoint used to fetch expired items. The action dispatched to this
1800
- endpoint will have a `timestamp` property with the current time as microseconds
1801
- since epoc (Januar 1, 1970 UTC), and `isodate` as the current time in the
1802
- extended ISO 8601 format(`YYYY-MM-DDThh:mm:ss.sssZ`).
1821
+ Here's an example of an `EXPIRE` action that will dispatch a `DELETE` directly:
1822
+
1823
+ ```javascript
1824
+ {
1825
+ type: 'EXPIRE',
1826
+ payload: {
1827
+ service: 'store',
1828
+ type: 'entry',
1829
+ deleteWithParams: true
1830
+ }
1831
+ }
1832
+ ```
1833
+
1834
+ The `GET` action (or the `DELETE` action when `deleteWithParams` is `true`) will
1835
+ have a `timestamp` property with the current time as microseconds since epoc
1836
+ (Januar 1, 1970 UTC), and `isodate` as the current time in the extended ISO 8601
1837
+ format(`YYYY-MM-DDThh:mm:ss.sssZ`).
1803
1838
 
1804
1839
  To have `timestamp` and `isodate` be a time in the future instead, set
1805
1840
  `msFromNow` to a positive number of milliseconds. This will be added to the
@@ -1889,7 +1924,220 @@ intention is not to replace an existing action handler.
1889
1924
 
1890
1925
  ## Jobs
1891
1926
 
1892
- > **Editor's note:** Write this section.
1927
+ You define jobs to run one or more actions on a schedule or to add additional
1928
+ logic that is not provided by one specific service endpoint. When you dispatch
1929
+ several actions, in sequence or in parallel, we call it a "flow".
1930
+
1931
+ A simple job running on a schedule, may look like this:
1932
+
1933
+ ```javascript
1934
+ const syncJob = {
1935
+ id: 'syncEntries',
1936
+ cron: '0 */1 * * *', // Every hour
1937
+ action: {
1938
+ type: 'SYNC',
1939
+ payload: {
1940
+ type: 'entry',
1941
+ retrieve: 'updated',
1942
+ from: 'entries',
1943
+ to: 'store',
1944
+ },
1945
+ },
1946
+ }
1947
+ ```
1948
+
1949
+ This will dispatch the given `SYNC` action every hour. (The `SYNC` action and
1950
+ cron syntax is out of scope in this section. Fron cron expressions,
1951
+ (Crontab)[https://crontab.cronhub.io] is a good and practical resource.)
1952
+
1953
+ An alternative to running a job on a schedule with `cron`, is to run it by
1954
+ dispatching a `RUN` action with the job id in the payload `jobId` param.
1955
+
1956
+ A flow may look like this:
1957
+
1958
+ ```javascript
1959
+ const flowJob = {
1960
+ id: 'getEntryFromOtherService',
1961
+ flow: [
1962
+ {
1963
+ id: 'getFromStore',
1964
+ action: {
1965
+ type: 'GET',
1966
+ payload: {
1967
+ type: 'entry',
1968
+ targetService: 'store',
1969
+ },
1970
+ },
1971
+ premutation: {
1972
+ payload: {
1973
+ $modify: 'payload',
1974
+ id: '^^.action.payload.id',
1975
+ },
1976
+ },
1977
+ },
1978
+ {
1979
+ id: 'getFromOtherService',
1980
+ action: {
1981
+ type: 'GET',
1982
+ payload: {
1983
+ type: 'entry',
1984
+ targetService: 'otherService',
1985
+ },
1986
+ },
1987
+ premutation: {
1988
+ payload: {
1989
+ $modify: 'payload',
1990
+ id: '^^.getFromStore.response.data.otherId',
1991
+ },
1992
+ },
1993
+ },
1994
+ ],
1995
+ }
1996
+ ```
1997
+
1998
+ Several things are going on here: First, we have a flow with two actions. We
1999
+ imagine here that we are going to fetch an entry with an id that is found in the
2000
+ `store` service, and use the `otherId` retrieved from that service to get the
2001
+ entry from `otherService`. The two steps in `flow` look a lot like a job, and
2002
+ in one way they are the same, with some differences, that we will get back to.
2003
+ They are run sequentally in the order they appear in the `flow` array.
2004
+
2005
+ Secondly, we have a `premutation` on each step. This is given the `action` and
2006
+ may mutate it before it is dispatched. As for endpoint mutations, the top level
2007
+ has `$modify: true` as default, but we need to modify the sub-objects we
2008
+ include, when that is what we want. In the first step, we set the payload `id`
2009
+ to the `id` provided in the action that called this job. This job is passed to
2010
+ mutations on jobs and steps under the name `'action'`, and we prepend it with
2011
+ the root path (`^^`) as it is found on the top level of the data structure we're
2012
+ mutating.
2013
+
2014
+ The second step is similar, but here we set the payload `id` to the `otherId`
2015
+ found in the response data of the first step. The action and the response from a
2016
+ step is available to all following steps by the id of the step, in this case
2017
+ `'getFromStore'`. We have to prepend with the root path (`^^`) here as well.
2018
+ When we say the action and response is available, we find it as an action object
2019
+ with any response on a `response` property.
2020
+
2021
+ With the action
2022
+ `{ type: 'RUN', payload: { jobId: 'getEntryFromOtherService', id: '12345' } }`,
2023
+ the first step will dispatch a `GET` for the id `12345`. If that action
2024
+ succeeds with the data `{ id: '12345', otherId: '67890' }`, the second step will
2025
+ dispatch a `GET` for the id `67890`. The response from the last action is
2026
+ returned by default.
2027
+
2028
+ If any job step fails, the entire job will fail and the error will be returned,
2029
+ unless you set up any `preconditions`, `postconditions`, or `postmutations` to
2030
+ alter this default behavior. More on that in the following sections.
2031
+
2032
+ ### Job and step mutations
2033
+
2034
+ Jobs and job steps provide two mechanisms for mutations: `premutation` and
2035
+ `postmutation`. They work in a similar way, but `premutation` is used to
2036
+ mutate the action of a job or a job step _before_ it is dispatched, and
2037
+ `postmutations` is used to mutate the response from a job or a step.
2038
+
2039
+ Note that `premutation` will not have an effect on a job with a `flow`, but
2040
+ `postmutation` may be used with the response from a flow.
2041
+
2042
+ Both mutation pipelines are passed an object that holds the action and response
2043
+ of every step that has been run so far, set on a property with the same key as
2044
+ the step id. The response is given as a `response` property on the action. The
2045
+ action that was dispatched to run the job is also included on the `'action'`
2046
+ property. (Thus a step may not have the id `'action'`.) The object also holds
2047
+ the action of the step on an internal property, and this is the starting point
2048
+ for the mutations. You do not reference the step action directly, just mutate
2049
+ was is given in the pipeline data and use the root path `^^` to get to the
2050
+ actions and responses of other steps.
2051
+
2052
+ For both pipelines, an action object is expected, and in the case of
2053
+ `postmutation` the action should have a `response` object which is what will be
2054
+ used as the response from the job or step.
2055
+
2056
+ ### Step conditions
2057
+
2058
+ By default, if a step in a flow fails, no more steps are run, and the entire job
2059
+ will fail with the response from the failed step. You may however provide your
2060
+ own conditions for when a step should be run and when a step should be regarded
2061
+ as having failed.
2062
+
2063
+ `preconditions` on a step must be an array of condition objects, that must all
2064
+ pass in order for the step to be run. A condition object must have a `condition`
2065
+ property with an array of mutation pipelines, that must all return truthy for
2066
+ the condition to be regarded as passed. Each pipeline is given the same object
2067
+ as is given to `premutation` with action and responses from previous steps, but
2068
+ without the action to be dispatched. See
2069
+ [the section on mutating jobs](#job-and-step-mutations) for more on this.
2070
+
2071
+ The condition object may also have a `failResponse` property with a response
2072
+ object that will be used as the response from the step if the condition fails.
2073
+
2074
+ Finally, the `condition` object may have a `break` property set to `true`, to
2075
+ signal that the entire job should fail if the condition fails. If `break` is not
2076
+ set, the step will just be skipped and the job flow continues.
2077
+
2078
+ > [!NOTE]
2079
+ > By setting the feature flag `breakByDefault` to `true` (on the `flags` object
2080
+ > in the defintions given to `Integreat.create()`), `break` will be `true` by
2081
+ > default, and you must set it to `false` to make the flow continue. This will
2082
+ > be the default behavior in the next major version of Integreat, so it's a good
2083
+ > idea to set the flag to `true` already now.
2084
+
2085
+ Note that a step has a default pre-condition, that will make it fail and stop
2086
+ the flow if the previous step failed. By specifying your own `preconditions`,
2087
+ you override this, and only your conditions will be used. But when you set
2088
+ `breakByDefault` to `true` (see note above), this default condition will be
2089
+ set in the `postconditions` instead, so that you may override it there. This
2090
+ way, you may set pre-conditions on a step, whithout overriding the fail-on-error
2091
+ behavior of the step before.
2092
+
2093
+ `postconditions` is also an array of condition objects, but this is used to
2094
+ decide if the step should be regarded as having failed after its action or flow
2095
+ has run. The condition pipelines are passed the same object as `postmutation`,
2096
+ but _after_ `postmutation` has been applied. Just as for `preconditions`, the
2097
+ `break` property is `false` by default, so to stop the entire job, set it to
2098
+ `true` (but see note on `breakByDefault` above). An error will usually cause
2099
+ the job to fail even with `break: false`, but the breaking may be handled by the
2100
+ `preconditions` on the next step, as describe above.
2101
+
2102
+ Post-conditions specify what is required for a step to be succeessful, and
2103
+ sometimes you may require a certain error as success, e.g. when you're checking
2104
+ a cache and will only continue if a value is not cached, requiring a `notfound`
2105
+ response status. The condition pipeline for this should be straight
2106
+ forward, but as you cannot specify the response that will be used when the
2107
+ condition _passes_, you may wonder what happens with the error response.
2108
+ Integreat will set the status of a passing response to `ok` if it was an error,
2109
+ and otherwise leave it as is. Also, when changing an error to an `ok`, any
2110
+ `error` property will be changed to a `warning`.
2111
+
2112
+ ### Dispatching several actions by iterating over an array
2113
+
2114
+ Sometimes you will want to dispatch several actions based on a data array, e.g.
2115
+ when you have an array of data items, but the relevant endpoint only accepts one
2116
+ data item. This may be done with `iterate`, which is a special mutation that is
2117
+ must return an array, and the job action will be dispatched once for every item
2118
+ in this array. The item will be set as payload `data`. `premutation` may be used
2119
+ to modify the action before it is dispatched as usual, but note that the
2120
+ mutation is applied to every single action, after the `iterate`, so to speak.
2121
+
2122
+ This applies to both a job with an action and a step with an action in a flow.
2123
+
2124
+ The responses of each action are combined and set as a `response` object on the
2125
+ step action (before the iteration), making an iterated step just like any other.
2126
+ When all actions are successful, the response will have status `ok`, and the
2127
+ response `data` will be an array of the data from each response in the order
2128
+ they where run. When there are errors, Integreat will use any common status, if
2129
+ possible, otherwise the status will be `'error'`. The `error` string will
2130
+ include all the indidivual errors, separated by a pipe (`|`). The individual
2131
+ responses will also be available on a `responses` property on the `response`
2132
+ object.
2133
+
2134
+ Every single iterated action and response will also be available on the step id
2135
+ with an index prefix, e.g. `getEntries` will have `getEntries_0`,
2136
+ `getEntries_1`, etc.
2137
+
2138
+ By default, the iterations are run in sequence, but you may run several in
2139
+ parallel by specifying the number of concurrent iterations on the
2140
+ `iterateConcurrency` property on the job step. The default is `1`.
1893
2141
 
1894
2142
  ## Queues
1895
2143
 
@@ -2018,7 +2266,8 @@ const great = Integreat.create(
2018
2266
  - `props`: You may provide alternative field names for the `id`, `roles`, and
2019
2267
  `tokens` for an ident in the schema specified on `type`. When the prop and the
2020
2268
  field has the same name, it may be omitted, though it doesn't hurt to specif
2021
- it anyway for clarity.
2269
+ it anyway for clarity. For setups that don't need `roles` and/or `tokens`, you
2270
+ may set these to `null`. Omitting them will result in the default field names.
2022
2271
 
2023
2272
  Note that in the example above, the `id` of the data will be used as the ident
2024
2273
  `id`. When the id is not suited for this, you will need another field on the
package/dist/Instance.js CHANGED
@@ -41,10 +41,10 @@ const setIdOnAuthenticators = (authenticators) => Object.fromEntries(Object.entr
41
41
  const createAuthObjects = (authDefs, authenticators) => authDefs
42
42
  .map(setUpAuth(authenticators))
43
43
  .reduce(indexById, {});
44
- function prepareJobs(jobDefs, mapOptions) {
44
+ function prepareJobs(jobDefs, mapOptions, breakByDefault) {
45
45
  const jobs = new Map();
46
46
  ensureArray(jobDefs).forEach((jobDef) => {
47
- const job = new Job(jobDef, mapOptions);
47
+ const job = new Job(jobDef, mapOptions, breakByDefault);
48
48
  jobs.set(job.id, new Job(jobDef, mapOptions));
49
49
  });
50
50
  return jobs;
@@ -75,9 +75,10 @@ function createServices(defs, resources, schemas, mapOptions, middlewareForServi
75
75
  .reduce(indexById, {});
76
76
  }
77
77
  function setupServicesAndDispatch(defs, resources, schemas, middlewareForDispatch, middlewareForService, emit) {
78
- const mapOptions = createMapOptions(schemas, defs.mutations, resources.transformers, defs.dictionaries);
78
+ const mapOptions = createMapOptions(schemas, defs.mutations, resources.transformers, defs.dictionaries, defs.nonvalues);
79
79
  const services = createServices(defs, resources, schemas, mapOptions, middlewareForService, emit);
80
- const jobs = prepareJobs(defs.jobs || [], mapOptions);
80
+ const breakByDefault = defs.flags?.breakByDefault ?? false;
81
+ const jobs = prepareJobs(defs.jobs || [], mapOptions, breakByDefault);
81
82
  const dispatch = createDispatch({
82
83
  schemas,
83
84
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C,EAAE,GAAG,IAAI,CAAC,EAAE,CAAA;QACjB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,CAAA;QACvC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAA;QACrC,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAE3C,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,wBAAwB,CACxE,IAAI,EACJ,SAAS,EACT,IAAI,CAAC,OAAO,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CACrB,CAAA;QAED,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAA;IAC5C,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC5D,CAAC;IAED,KAAK,CAAC,KAAK;QACT,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAA;IAC5C,CAAC;CACF"}
@@ -1,11 +1,12 @@
1
- import mapTransform from 'map-transform';
1
+ import { pathGetter } from 'map-transform';
2
2
  import { isObject } from '../utils/is.js';
3
+ const state = { context: [], value: undefined };
3
4
  const compareValues = (expected, value) => expected !== undefined && Array.isArray(expected)
4
5
  ? expected.includes(value)
5
6
  : expected === value;
6
7
  const getIsMatchCount = (matches) => matches.filter(([match]) => !!match).length;
7
8
  const getHasPropsCount = (matches) => matches.filter(([, exists]) => !!exists).length;
8
- async function validateOptions(options, action) {
9
+ function validateOptions(options, action) {
9
10
  if (action === null) {
10
11
  return [false, false];
11
12
  }
@@ -13,10 +14,10 @@ async function validateOptions(options, action) {
13
14
  if (pathAndExpectedArr.length === 0) {
14
15
  return [true, false];
15
16
  }
16
- const matches = await Promise.all(pathAndExpectedArr.map(async function ([path, expected]) {
17
- const value = await mapTransform(path)(action);
17
+ const matches = pathAndExpectedArr.map(function ([path, expected,]) {
18
+ const value = pathGetter(path)(action, state);
18
19
  return [compareValues(expected, value), value !== undefined];
19
- }));
20
+ });
20
21
  return [
21
22
  getIsMatchCount(matches) === pathAndExpectedArr.length,
22
23
  getHasPropsCount(matches) > 0,
@@ -31,7 +32,7 @@ const optionsAuth = {
31
32
  },
32
33
  async validate(_authentication, options, action) {
33
34
  const { identId, ...authOptions } = options || {};
34
- const [isValid, hasProps] = await validateOptions(authOptions, action);
35
+ const [isValid, hasProps] = validateOptions(authOptions, action);
35
36
  if (isValid) {
36
37
  return { status: 'ok', access: { ident: { id: identId } } };
37
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/authenticators/options.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAQzC,MAAM,aAAa,GAAG,CAAC,QAA6B,EAAE,KAAc,EAAE,EAAE,CACtE,QAAQ,KAAK,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC/C,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC1B,CAAC,CAAC,QAAQ,KAAK,KAAK,CAAA;AAExB,MAAM,eAAe,GAAG,CAAC,OAA6B,EAAE,EAAE,CACxD,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAA;AAE7C,MAAM,gBAAgB,GAAG,CAAC,OAA6B,EAAE,EAAE,CACzD,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,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AAE,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,cAAc,CAAA;gBAC7C,IAAI,MAAM,KAAK,SAAS,EAAE;oBACxB,OAAO,OAAO,CAAA;iBACf;aACF;YACD,OAAO,EAAE,CAAA;QACX,CAAC;QAOD,aAAa,CACX,cAAqC;YAErC,IAAI,QAAQ,CAAC,cAAc,CAAC,EAAE;gBAC5B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,cAAc,CAAA;gBAC7C,IAAI,MAAM,KAAK,SAAS,EAAE;oBACxB,OAAO,OAAO,CAAA;iBACf;aACF;YACD,OAAO,EAAE,CAAA;QACX,CAAC;KACF;CACF,CAAA;AAED,eAAe,WAAW,CAAA"}
@@ -1,4 +1,4 @@
1
1
  import type Job from './jobs/Job.js';
2
- import type { Dispatch, Action } from './types.js';
2
+ import { Dispatch, Action } from './types.js';
3
3
  declare const _default: (dispatch: Dispatch, jobs: Job[]) => (from: Date, to: Date) => Promise<Action[]>;
4
4
  export default _default;
@@ -1,6 +1,10 @@
1
+ import { IdentType } from './types.js';
1
2
  export default (dispatch, jobs) => async function dispatchScheduled(from, to) {
2
3
  const dispatched = [];
3
- const meta = { ident: { id: 'scheduler' }, queue: true };
4
+ const meta = {
5
+ ident: { id: 'scheduler', type: IdentType.Scheduler },
6
+ queue: true,
7
+ };
4
8
  for (const job of jobs) {
5
9
  if (job && job.schedule) {
6
10
  if (job.schedule.shouldRun(from, to)) {
@@ -1 +1 @@
1
- {"version":3,"file":"dispatchScheduled.js","sourceRoot":"","sources":["../src/dispatchScheduled.ts"],"names":[],"mappings":"AAGA,eAAe,CAAC,QAAkB,EAAE,IAAW,EAAE,EAAE,CACjD,KAAK,UAAU,iBAAiB,CAAC,IAAU,EAAE,EAAQ;IACnD,MAAM,UAAU,GAAa,EAAE,CAAA;IAC/B,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,C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AAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAA;gBACvC,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAA;aACzC;SACF;KACF;IAED,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA"}
@@ -1,50 +1,53 @@
1
1
  import { createErrorResponse } from '../utils/response.js';
2
2
  import { isTypedData } from '../utils/is.js';
3
3
  const isTypedDataArray = (value) => Array.isArray(value) && isTypedData(value[0]);
4
- const getExpired = async (targetService, type, endpointId, msFromNow, dispatch, cid, ident) => {
4
+ const createDeleteAction = (type, data, targetService, ident, cid) => ({
5
+ type: 'DELETE',
6
+ payload: {
7
+ type,
8
+ data,
9
+ ...(targetService && { targetService }),
10
+ },
11
+ meta: { ident, queue: true, cid },
12
+ });
13
+ const getOrDeleteExpired = async (deleteWithParams, dispatch, type, msFromNow, targetService, endpointId, cid, ident) => {
5
14
  const timestamp = Date.now() + msFromNow;
6
15
  const isodate = new Date(timestamp).toISOString();
7
16
  return dispatch({
8
- type: 'GET',
17
+ type: deleteWithParams ? 'DELETE' : 'GET',
9
18
  payload: {
10
19
  type,
11
20
  timestamp,
12
21
  isodate,
13
- targetService,
14
- endpoint: endpointId,
22
+ ...(targetService && { targetService }),
23
+ ...(endpointId && { endpoint: endpointId }),
15
24
  },
16
- meta: { ident, cid },
25
+ meta: { ident, cid, ...(deleteWithParams ? { queue: true } : {}) },
17
26
  });
18
27
  };
19
- const deleteExpired = async (data, targetService, dispatch, cid, ident) => {
28
+ async function deleteItems(dispatch, response, type, serviceId, cid, ident) {
29
+ if (response.status !== 'ok') {
30
+ return createErrorResponse(`Could not get items from service '${serviceId}'. Reason: ${response.status} ${response.error}`, 'handler:EXPIRE');
31
+ }
32
+ const data = response.data;
33
+ if (!isTypedDataArray(data)) {
34
+ return createErrorResponse(`No items to expire from service '${serviceId}'`, 'handler:EXPIRE', 'noaction');
35
+ }
20
36
  const deleteData = data.map((item) => ({ id: item.id, $type: item.$type }));
21
- const deleteAction = {
22
- type: 'DELETE',
23
- payload: { data: deleteData, targetService },
24
- meta: { ident, queue: true, cid },
25
- };
26
- return await dispatch(deleteAction);
27
- };
37
+ return await dispatch(createDeleteAction(type, deleteData, serviceId, ident, cid));
38
+ }
28
39
  export default async function expire(action, { dispatch }) {
29
- const { payload: { type, endpoint: endpointId, targetService: serviceId }, meta: { ident, cid } = {}, } = action;
40
+ const { payload: { type, endpoint: endpointId, targetService: serviceId, deleteWithParams = false, }, meta: { ident, cid } = {}, } = action;
30
41
  const msFromNow = action.payload.msFromNow || 0;
31
- if (!serviceId) {
32
- return createErrorResponse(`Can't delete expired without a specified service`, 'handler:EXPIRE');
33
- }
34
- if (!endpointId) {
35
- return createErrorResponse(`Can't delete expired from service '${serviceId}' without an endpoint`, 'handler:EXPIRE');
36
- }
37
42
  if (!type) {
38
43
  return createErrorResponse(`Can't delete expired from service '${serviceId}' without one or more specified types`, 'handler:EXPIRE', 'badrequest');
39
44
  }
40
- const expiredResponse = await getExpired(serviceId, type, endpointId, msFromNow, dispatch, cid, ident);
41
- if (expiredResponse.status !== 'ok') {
42
- return createErrorResponse(`Could not get items from service '${serviceId}'. Reason: ${expiredResponse.status} ${expiredResponse.error}`, 'handler:EXPIRE');
45
+ const response = await getOrDeleteExpired(!!deleteWithParams, dispatch, type, msFromNow, serviceId, endpointId, cid, ident);
46
+ if (deleteWithParams) {
47
+ return response;
43
48
  }
44
- const data = expiredResponse.data;
45
- if (!isTypedDataArray(data)) {
46
- return createErrorResponse(`No items to expire from service '${serviceId}'`, 'handler:EXPIRE', 'noaction');
49
+ else {
50
+ return await deleteItems(dispatch, response, type, serviceId, cid, ident);
47
51
  }
48
- return await deleteExpired(data, serviceId, dispatch, cid, ident);
49
52
  }
50
53
  //# sourceMappingURL=expire.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"expire.js","sourceRoot":"","sources":["../../src/handlers/expire.ts"],"names":[],"mappings":"AAAA,OAAO,E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