@strapi/strapi 4.10.0-beta.1 → 4.10.1-experimental.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.
- package/bin/strapi.js +2 -468
- package/coverage/clover.xml +1613 -0
- package/coverage/coverage-final.json +48 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/commands/__tests__/data-transfer/shared/index.html +116 -0
- package/coverage/lcov-report/commands/__tests__/data-transfer/shared/transfer.test.utils.js.html +133 -0
- package/coverage/lcov-report/commands/admin-create.js.html +424 -0
- package/coverage/lcov-report/commands/admin-reset.js.html +241 -0
- package/coverage/lcov-report/commands/generate-template.js.html +373 -0
- package/coverage/lcov-report/commands/index.html +146 -0
- package/coverage/lcov-report/commands/transfer/export.js.html +619 -0
- package/coverage/lcov-report/commands/transfer/import.js.html +562 -0
- package/coverage/lcov-report/commands/transfer/index.html +146 -0
- package/coverage/lcov-report/commands/transfer/transfer.js.html +532 -0
- package/coverage/lcov-report/commands/utils/helpers.js.html +430 -0
- package/coverage/lcov-report/commands/utils/index.html +116 -0
- package/coverage/lcov-report/core/registries/custom-fields.js.html +301 -0
- package/coverage/lcov-report/core/registries/index.html +116 -0
- package/coverage/lcov-report/core-api/controller/collection-type.js.html +418 -0
- package/coverage/lcov-report/core-api/controller/index.html +161 -0
- package/coverage/lcov-report/core-api/controller/index.js.html +220 -0
- package/coverage/lcov-report/core-api/controller/single-type.js.html +274 -0
- package/coverage/lcov-report/core-api/controller/transform.js.html +376 -0
- package/coverage/lcov-report/core-api/service/collection-type.js.html +325 -0
- package/coverage/lcov-report/core-api/service/index.html +161 -0
- package/coverage/lcov-report/core-api/service/index.js.html +220 -0
- package/coverage/lcov-report/core-api/service/pagination.js.html +460 -0
- package/coverage/lcov-report/core-api/service/single-type.js.html +301 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +386 -0
- package/coverage/lcov-report/load/filepath-to-prop-path.js.html +151 -0
- package/coverage/lcov-report/load/index.html +116 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/services/content-api/index.html +116 -0
- package/coverage/lcov-report/services/content-api/index.js.html +307 -0
- package/coverage/lcov-report/services/content-api/permissions/engine.js.html +100 -0
- package/coverage/lcov-report/services/content-api/permissions/index.html +131 -0
- package/coverage/lcov-report/services/content-api/permissions/index.js.html +529 -0
- package/coverage/lcov-report/services/content-api/permissions/providers/action.js.html +142 -0
- package/coverage/lcov-report/services/content-api/permissions/providers/condition.js.html +142 -0
- package/coverage/lcov-report/services/content-api/permissions/providers/index.html +146 -0
- package/coverage/lcov-report/services/content-api/permissions/providers/index.js.html +112 -0
- package/coverage/lcov-report/services/core-store.js.html +520 -0
- package/coverage/lcov-report/services/entity-service/attributes/index.html +131 -0
- package/coverage/lcov-report/services/entity-service/attributes/index.js.html +178 -0
- package/coverage/lcov-report/services/entity-service/attributes/transforms.js.html +145 -0
- package/coverage/lcov-report/services/entity-service/components.js.html +1246 -0
- package/coverage/lcov-report/services/entity-service/index.html +146 -0
- package/coverage/lcov-report/services/entity-service/index.js.html +1120 -0
- package/coverage/lcov-report/services/entity-service/params.js.html +112 -0
- package/coverage/lcov-report/services/entity-validator/__tests__/relations/utils/index.html +116 -0
- package/coverage/lcov-report/services/entity-validator/__tests__/relations/utils/relations.testdata.js.html +544 -0
- package/coverage/lcov-report/services/entity-validator/index.html +131 -0
- package/coverage/lcov-report/services/entity-validator/index.js.html +1231 -0
- package/coverage/lcov-report/services/entity-validator/validators.js.html +733 -0
- package/coverage/lcov-report/services/event-hub.js.html +319 -0
- package/coverage/lcov-report/services/fs.js.html +259 -0
- package/coverage/lcov-report/services/index.html +161 -0
- package/coverage/lcov-report/services/metrics/admin-user-hash.js.html +148 -0
- package/coverage/lcov-report/services/metrics/index.html +206 -0
- package/coverage/lcov-report/services/metrics/index.js.html +265 -0
- package/coverage/lcov-report/services/metrics/is-truthy.js.html +112 -0
- package/coverage/lcov-report/services/metrics/middleware.js.html +184 -0
- package/coverage/lcov-report/services/metrics/rate-limiter.js.html +166 -0
- package/coverage/lcov-report/services/metrics/sender.js.html +394 -0
- package/coverage/lcov-report/services/metrics/stringify-deep.js.html +151 -0
- package/coverage/lcov-report/services/utils/index.html +116 -0
- package/coverage/lcov-report/services/utils/upload-files.js.html +322 -0
- package/coverage/lcov-report/services/worker-queue.js.html +262 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov-report/utils/convert-custom-field-type.js.html +151 -0
- package/coverage/lcov-report/utils/index.html +146 -0
- package/coverage/lcov-report/utils/machine-id.js.html +127 -0
- package/coverage/lcov-report/utils/url-from-segments.js.html +121 -0
- package/ee/LICENSE.txt +21 -0
- package/ee/index.js +3 -1
- package/ee/license.js +8 -7
- package/lib/Strapi.js +3 -0
- package/lib/commands/__tests__/commands.test.js +20 -0
- package/lib/commands/__tests__/commands.test.utils.js +16 -0
- package/lib/commands/actions/admin/create-user/__tests__/admin.create-user.test.js +450 -0
- package/lib/commands/{admin-create.js → actions/admin/create-user/action.js} +2 -2
- package/lib/commands/actions/admin/create-user/command.js +19 -0
- package/lib/commands/actions/admin/reset-user-password/__tests__/admin.reset-user-password.test.js +145 -0
- package/lib/commands/{admin-reset.js → actions/admin/reset-user-password/action.js} +2 -2
- package/lib/commands/actions/admin/reset-user-password/command.js +17 -0
- package/lib/commands/{build.js → actions/build/action.js} +2 -2
- package/lib/commands/actions/build/command.js +15 -0
- package/lib/commands/{configurationDump.js → actions/configuration/dump/action.js} +1 -1
- package/lib/commands/actions/configuration/dump/command.js +17 -0
- package/lib/commands/{configurationRestore.js → actions/configuration/restore/action.js} +1 -1
- package/lib/commands/actions/configuration/restore/command.js +17 -0
- package/lib/commands/{console.js → actions/console/action.js} +2 -2
- package/lib/commands/actions/console/command.js +14 -0
- package/lib/commands/{content-types/list.js → actions/content-types/list/action.js} +2 -2
- package/lib/commands/actions/content-types/list/command.js +14 -0
- package/lib/commands/{controllers/list.js → actions/controllers/list/action.js} +2 -2
- package/lib/commands/actions/controllers/list/command.js +14 -0
- package/lib/commands/{develop.js → actions/develop/action.js} +3 -3
- package/lib/commands/actions/develop/command.js +19 -0
- package/lib/commands/actions/export/__tests__/export.test.js +175 -0
- package/lib/commands/{transfer/export.js → actions/export/action.js} +3 -2
- package/lib/commands/actions/export/command.js +45 -0
- package/lib/commands/actions/generate/command.js +18 -0
- package/lib/commands/{hooks/list.js → actions/hooks/list/action.js} +2 -2
- package/lib/commands/actions/hooks/list/command.js +14 -0
- package/lib/commands/actions/import/__tests__/import.test.js +143 -0
- package/lib/commands/{transfer/import.js → actions/import/action.js} +2 -2
- package/lib/commands/actions/import/command.js +97 -0
- package/lib/commands/{install.js → actions/install/action.js} +1 -1
- package/lib/commands/actions/install/command.js +14 -0
- package/lib/commands/{middlewares/list.js → actions/middlewares/list/action.js} +2 -2
- package/lib/commands/actions/middlewares/list/command.js +14 -0
- package/lib/commands/{new.js → actions/new/action.js} +1 -1
- package/lib/commands/actions/new/command.js +35 -0
- package/lib/commands/{policies/list.js → actions/policies/list/action.js} +2 -2
- package/lib/commands/actions/policies/list/command.js +14 -0
- package/lib/commands/{report.js → actions/report/action.js} +1 -1
- package/lib/commands/actions/report/command.js +17 -0
- package/lib/commands/{routes/list.js → actions/routes/list/action.js} +2 -2
- package/lib/commands/actions/routes/list/command.js +14 -0
- package/lib/commands/{services/list.js → actions/services/list/action.js} +2 -2
- package/lib/commands/actions/services/list/command.js +14 -0
- package/lib/commands/{start.js → actions/start/action.js} +1 -1
- package/lib/commands/actions/start/command.js +14 -0
- package/lib/commands/{opt-out-telemetry.js → actions/telemetry/disable/action.js} +1 -1
- package/lib/commands/actions/telemetry/disable/command.js +14 -0
- package/lib/commands/{opt-in-telemetry.js → actions/telemetry/enable/action.js} +1 -1
- package/lib/commands/actions/telemetry/enable/command.js +14 -0
- package/lib/commands/actions/templates/generate/__tests__/templates.generate.js +118 -0
- package/lib/commands/actions/templates/generate/command.js +14 -0
- package/lib/commands/actions/transfer/__tests__/transfer.test.js +178 -0
- package/lib/commands/{transfer/transfer.js → actions/transfer/action.js} +2 -2
- package/lib/commands/actions/transfer/command.js +115 -0
- package/lib/commands/{ts/generate-types.js → actions/ts/generate-types/action.js} +2 -2
- package/lib/commands/actions/ts/generate-types/command.js +21 -0
- package/lib/commands/{uninstall.js → actions/uninstall/action.js} +1 -1
- package/lib/commands/actions/uninstall/command.js +15 -0
- package/lib/commands/actions/version/command.js +19 -0
- package/lib/commands/{watchAdmin.js → actions/watch-admin/action.js} +4 -4
- package/lib/commands/actions/watch-admin/command.js +15 -0
- package/lib/commands/index.js +66 -0
- package/lib/commands/{transfer/utils.js → utils/data-transfer.js} +2 -2
- package/lib/commands/utils/helpers.js +54 -3
- package/lib/core/registries/__tests__/custom-fields.test.js +152 -0
- package/lib/core/registries/custom-fields.js +19 -2
- package/lib/core-api/__tests__/controller.test.js +39 -0
- package/lib/core-api/controller/__tests__/transform.test.js +226 -0
- package/lib/core-api/service/__tests__/index.test.js +127 -0
- package/lib/core-api/service/__tests__/pagination.test.js +275 -0
- package/lib/load/__tests__/filepath-to-prop-path.test.js +30 -0
- package/lib/middlewares/__tests__/errors.test.js +21 -0
- package/lib/services/__tests__/content-api-permissions.test.js +291 -0
- package/lib/services/__tests__/core-store.test.js +148 -0
- package/lib/services/__tests__/event-hub.test.js +126 -0
- package/lib/services/__tests__/fs.test.js +78 -0
- package/lib/services/__tests__/worker-queue.test.js +47 -0
- package/lib/services/entity-service/__tests__/entity-service-events.test.js +117 -0
- package/lib/services/entity-service/__tests__/entity-service.test.js +587 -0
- package/lib/services/entity-validator/__tests__/biginteger-validators.test.js +220 -0
- package/lib/services/entity-validator/__tests__/date-validators.test.js +183 -0
- package/lib/services/entity-validator/__tests__/datetime-validators.test.js +183 -0
- package/lib/services/entity-validator/__tests__/email-validators.test.js +56 -0
- package/lib/services/entity-validator/__tests__/enumeration-validators.test.js +43 -0
- package/lib/services/entity-validator/__tests__/float-validators.test.js +278 -0
- package/lib/services/entity-validator/__tests__/index.test.js +609 -0
- package/lib/services/entity-validator/__tests__/integer-validators.test.js +278 -0
- package/lib/services/entity-validator/__tests__/relations/attribute-level.test.js +123 -0
- package/lib/services/entity-validator/__tests__/relations/component-level.test.js +275 -0
- package/lib/services/entity-validator/__tests__/relations/dynamic-zone-level.test.js +159 -0
- package/lib/services/entity-validator/__tests__/relations/media-level.test.js +74 -0
- package/lib/services/entity-validator/__tests__/relations/utils/relations.testdata.js +153 -0
- package/lib/services/entity-validator/__tests__/string-validators.test.js +374 -0
- package/lib/services/entity-validator/__tests__/time-validators.test.js +183 -0
- package/lib/services/entity-validator/__tests__/timestamp-validators.test.js +204 -0
- package/lib/services/entity-validator/__tests__/uid-validators.test.js +229 -0
- package/lib/services/metrics/__tests__/admin-user-hash.test.js +41 -0
- package/lib/services/metrics/__tests__/index.test.js +157 -0
- package/lib/services/metrics/__tests__/is-truthy.js +33 -0
- package/lib/services/metrics/__tests__/middleware.test.js +60 -0
- package/lib/services/metrics/__tests__/rate-limiter.test.js +50 -0
- package/lib/services/metrics/__tests__/stringify-deep.test.js +27 -0
- package/lib/services/metrics/sender.js +1 -2
- package/lib/services/webhook-runner.js +4 -4
- package/lib/types/core/commands/index.d.ts +6 -0
- package/lib/utils/__tests__/convert-custom-field-type.test.js +69 -0
- package/lib/utils/__tests__/url-from-segments.test.js +40 -0
- package/lib/utils/fetch.js +23 -0
- package/package.json +17 -16
- /package/lib/commands/{generate-template.js → actions/templates/generate/action.js} +0 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
|
|
2
|
+
<!doctype html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
|
|
5
|
+
<head>
|
|
6
|
+
<title>Code coverage report for core-api/service/index.js</title>
|
|
7
|
+
<meta charset="utf-8" />
|
|
8
|
+
<link rel="stylesheet" href="../../prettify.css" />
|
|
9
|
+
<link rel="stylesheet" href="../../base.css" />
|
|
10
|
+
<link rel="shortcut icon" type="image/x-icon" href="../../favicon.png" />
|
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
12
|
+
<style type='text/css'>
|
|
13
|
+
.coverage-summary .sorter {
|
|
14
|
+
background-image: url(../../sort-arrow-sprite.png);
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<div class='wrapper'>
|
|
21
|
+
<div class='pad1'>
|
|
22
|
+
<h1><a href="../../index.html">All files</a> / <a href="index.html">core-api/service</a> index.js</h1>
|
|
23
|
+
<div class='clearfix'>
|
|
24
|
+
|
|
25
|
+
<div class='fl pad1y space-right2'>
|
|
26
|
+
<span class="strong">100% </span>
|
|
27
|
+
<span class="quiet">Statements</span>
|
|
28
|
+
<span class='fraction'>12/12</span>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<div class='fl pad1y space-right2'>
|
|
33
|
+
<span class="strong">66.66% </span>
|
|
34
|
+
<span class="quiet">Branches</span>
|
|
35
|
+
<span class='fraction'>2/3</span>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
<div class='fl pad1y space-right2'>
|
|
40
|
+
<span class="strong">100% </span>
|
|
41
|
+
<span class="quiet">Functions</span>
|
|
42
|
+
<span class='fraction'>2/2</span>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<div class='fl pad1y space-right2'>
|
|
47
|
+
<span class="strong">100% </span>
|
|
48
|
+
<span class="quiet">Lines</span>
|
|
49
|
+
<span class='fraction'>12/12</span>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
<p class="quiet">
|
|
55
|
+
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
56
|
+
</p>
|
|
57
|
+
<template id="filterTemplate">
|
|
58
|
+
<div class="quiet">
|
|
59
|
+
Filter:
|
|
60
|
+
<input oninput="onInput()" type="search" id="fileSearch">
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
</div>
|
|
64
|
+
<div class='status-line high'></div>
|
|
65
|
+
<pre><table class="coverage">
|
|
66
|
+
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
67
|
+
<a name='L2'></a><a href='#L2'>2</a>
|
|
68
|
+
<a name='L3'></a><a href='#L3'>3</a>
|
|
69
|
+
<a name='L4'></a><a href='#L4'>4</a>
|
|
70
|
+
<a name='L5'></a><a href='#L5'>5</a>
|
|
71
|
+
<a name='L6'></a><a href='#L6'>6</a>
|
|
72
|
+
<a name='L7'></a><a href='#L7'>7</a>
|
|
73
|
+
<a name='L8'></a><a href='#L8'>8</a>
|
|
74
|
+
<a name='L9'></a><a href='#L9'>9</a>
|
|
75
|
+
<a name='L10'></a><a href='#L10'>10</a>
|
|
76
|
+
<a name='L11'></a><a href='#L11'>11</a>
|
|
77
|
+
<a name='L12'></a><a href='#L12'>12</a>
|
|
78
|
+
<a name='L13'></a><a href='#L13'>13</a>
|
|
79
|
+
<a name='L14'></a><a href='#L14'>14</a>
|
|
80
|
+
<a name='L15'></a><a href='#L15'>15</a>
|
|
81
|
+
<a name='L16'></a><a href='#L16'>16</a>
|
|
82
|
+
<a name='L17'></a><a href='#L17'>17</a>
|
|
83
|
+
<a name='L18'></a><a href='#L18'>18</a>
|
|
84
|
+
<a name='L19'></a><a href='#L19'>19</a>
|
|
85
|
+
<a name='L20'></a><a href='#L20'>20</a>
|
|
86
|
+
<a name='L21'></a><a href='#L21'>21</a>
|
|
87
|
+
<a name='L22'></a><a href='#L22'>22</a>
|
|
88
|
+
<a name='L23'></a><a href='#L23'>23</a>
|
|
89
|
+
<a name='L24'></a><a href='#L24'>24</a>
|
|
90
|
+
<a name='L25'></a><a href='#L25'>25</a>
|
|
91
|
+
<a name='L26'></a><a href='#L26'>26</a>
|
|
92
|
+
<a name='L27'></a><a href='#L27'>27</a>
|
|
93
|
+
<a name='L28'></a><a href='#L28'>28</a>
|
|
94
|
+
<a name='L29'></a><a href='#L29'>29</a>
|
|
95
|
+
<a name='L30'></a><a href='#L30'>30</a>
|
|
96
|
+
<a name='L31'></a><a href='#L31'>31</a>
|
|
97
|
+
<a name='L32'></a><a href='#L32'>32</a>
|
|
98
|
+
<a name='L33'></a><a href='#L33'>33</a>
|
|
99
|
+
<a name='L34'></a><a href='#L34'>34</a>
|
|
100
|
+
<a name='L35'></a><a href='#L35'>35</a>
|
|
101
|
+
<a name='L36'></a><a href='#L36'>36</a>
|
|
102
|
+
<a name='L37'></a><a href='#L37'>37</a>
|
|
103
|
+
<a name='L38'></a><a href='#L38'>38</a>
|
|
104
|
+
<a name='L39'></a><a href='#L39'>39</a>
|
|
105
|
+
<a name='L40'></a><a href='#L40'>40</a>
|
|
106
|
+
<a name='L41'></a><a href='#L41'>41</a>
|
|
107
|
+
<a name='L42'></a><a href='#L42'>42</a>
|
|
108
|
+
<a name='L43'></a><a href='#L43'>43</a>
|
|
109
|
+
<a name='L44'></a><a href='#L44'>44</a>
|
|
110
|
+
<a name='L45'></a><a href='#L45'>45</a>
|
|
111
|
+
<a name='L46'></a><a href='#L46'>46</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
112
|
+
<span class="cline-any cline-neutral"> </span>
|
|
113
|
+
<span class="cline-any cline-neutral"> </span>
|
|
114
|
+
<span class="cline-any cline-neutral"> </span>
|
|
115
|
+
<span class="cline-any cline-neutral"> </span>
|
|
116
|
+
<span class="cline-any cline-yes">1x</span>
|
|
117
|
+
<span class="cline-any cline-neutral"> </span>
|
|
118
|
+
<span class="cline-any cline-yes">1x</span>
|
|
119
|
+
<span class="cline-any cline-yes">1x</span>
|
|
120
|
+
<span class="cline-any cline-neutral"> </span>
|
|
121
|
+
<span class="cline-any cline-neutral"> </span>
|
|
122
|
+
<span class="cline-any cline-neutral"> </span>
|
|
123
|
+
<span class="cline-any cline-neutral"> </span>
|
|
124
|
+
<span class="cline-any cline-neutral"> </span>
|
|
125
|
+
<span class="cline-any cline-neutral"> </span>
|
|
126
|
+
<span class="cline-any cline-yes">1x</span>
|
|
127
|
+
<span class="cline-any cline-yes">5x</span>
|
|
128
|
+
<span class="cline-any cline-neutral"> </span>
|
|
129
|
+
<span class="cline-any cline-neutral"> </span>
|
|
130
|
+
<span class="cline-any cline-neutral"> </span>
|
|
131
|
+
<span class="cline-any cline-yes">5x</span>
|
|
132
|
+
<span class="cline-any cline-yes">4x</span>
|
|
133
|
+
<span class="cline-any cline-neutral"> </span>
|
|
134
|
+
<span class="cline-any cline-yes">1x</span>
|
|
135
|
+
<span class="cline-any cline-neutral"> </span>
|
|
136
|
+
<span class="cline-any cline-neutral"> </span>
|
|
137
|
+
<span class="cline-any cline-yes">5x</span>
|
|
138
|
+
<span class="cline-any cline-neutral"> </span>
|
|
139
|
+
<span class="cline-any cline-neutral"> </span>
|
|
140
|
+
<span class="cline-any cline-neutral"> </span>
|
|
141
|
+
<span class="cline-any cline-neutral"> </span>
|
|
142
|
+
<span class="cline-any cline-neutral"> </span>
|
|
143
|
+
<span class="cline-any cline-neutral"> </span>
|
|
144
|
+
<span class="cline-any cline-neutral"> </span>
|
|
145
|
+
<span class="cline-any cline-yes">1x</span>
|
|
146
|
+
<span class="cline-any cline-yes">3x</span>
|
|
147
|
+
<span class="cline-any cline-neutral"> </span>
|
|
148
|
+
<span class="cline-any cline-neutral"> </span>
|
|
149
|
+
<span class="cline-any cline-neutral"> </span>
|
|
150
|
+
<span class="cline-any cline-neutral"> </span>
|
|
151
|
+
<span class="cline-any cline-neutral"> </span>
|
|
152
|
+
<span class="cline-any cline-yes">1x</span>
|
|
153
|
+
<span class="cline-any cline-neutral"> </span>
|
|
154
|
+
<span class="cline-any cline-neutral"> </span>
|
|
155
|
+
<span class="cline-any cline-neutral"> </span>
|
|
156
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">'use strict';
|
|
157
|
+
|
|
158
|
+
const {
|
|
159
|
+
isSingleType,
|
|
160
|
+
constants: { DP_PUB_STATE_LIVE },
|
|
161
|
+
} = require('@strapi/utils').contentTypes;
|
|
162
|
+
|
|
163
|
+
const createSingleTypeService = require('./single-type');
|
|
164
|
+
const createCollectionTypeService = require('./collection-type');
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Returns a core api for the provided model
|
|
168
|
+
* @param {{ model: object, strapi: object }} context
|
|
169
|
+
* @returns {object}
|
|
170
|
+
*/
|
|
171
|
+
const createService = ({ contentType }) => {
|
|
172
|
+
const proto = { getFetchParams };
|
|
173
|
+
|
|
174
|
+
let service;
|
|
175
|
+
|
|
176
|
+
if (isSingleType(contentType)) {
|
|
177
|
+
service = createSingleTypeService({ contentType });
|
|
178
|
+
} else {
|
|
179
|
+
service = createCollectionTypeService({ contentType });
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return Object.assign(Object.create(proto), service);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Create default fetch params
|
|
187
|
+
* @param {*} params
|
|
188
|
+
* @returns
|
|
189
|
+
*/
|
|
190
|
+
const getFetchParams = (params = <span class="branch-0 cbranch-no" title="branch not covered" >{})</span> => {
|
|
191
|
+
return {
|
|
192
|
+
publicationState: DP_PUB_STATE_LIVE,
|
|
193
|
+
...params,
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
module.exports = {
|
|
198
|
+
createService,
|
|
199
|
+
getFetchParams,
|
|
200
|
+
};
|
|
201
|
+
</pre></td></tr></table></pre>
|
|
202
|
+
|
|
203
|
+
<div class='push'></div><!-- for sticky footer -->
|
|
204
|
+
</div><!-- /wrapper -->
|
|
205
|
+
<div class='footer quiet pad2 space-top1 center small'>
|
|
206
|
+
Code coverage generated by
|
|
207
|
+
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
208
|
+
at 2023-03-15T08:52:47.190Z
|
|
209
|
+
</div>
|
|
210
|
+
<script src="../../prettify.js"></script>
|
|
211
|
+
<script>
|
|
212
|
+
window.onload = function () {
|
|
213
|
+
prettyPrint();
|
|
214
|
+
};
|
|
215
|
+
</script>
|
|
216
|
+
<script src="../../sorter.js"></script>
|
|
217
|
+
<script src="../../block-navigation.js"></script>
|
|
218
|
+
</body>
|
|
219
|
+
</html>
|
|
220
|
+
|