@jskit-ai/google-rewarded-core 0.1.73 → 0.1.74

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.
@@ -1,7 +1,7 @@
1
1
  export default Object.freeze({
2
2
  packageVersion: 1,
3
3
  packageId: "@jskit-ai/google-rewarded-core",
4
- version: "0.1.73",
4
+ version: "0.1.74",
5
5
  kind: "runtime",
6
6
  description: "Google rewarded workflow runtime plus internal CRUD providers for rules, provider configs, watch sessions, and unlock receipts.",
7
7
  dependsOn: [
@@ -128,14 +128,14 @@ export default Object.freeze({
128
128
  mutations: {
129
129
  dependencies: {
130
130
  runtime: {
131
- "@jskit-ai/auth-core": "0.1.134",
132
- "@jskit-ai/crud-core": "0.1.145",
133
- "@jskit-ai/database-runtime": "0.1.135",
134
- "@jskit-ai/http-runtime": "0.1.134",
135
- "@jskit-ai/json-rest-api-core": "0.1.80",
136
- "@jskit-ai/kernel": "0.1.136",
137
- "@jskit-ai/resource-crud-core": "0.1.79",
138
- "@jskit-ai/workspaces-core": "0.1.115"
131
+ "@jskit-ai/auth-core": "0.1.135",
132
+ "@jskit-ai/crud-core": "0.1.147",
133
+ "@jskit-ai/database-runtime": "0.1.136",
134
+ "@jskit-ai/http-runtime": "0.1.135",
135
+ "@jskit-ai/json-rest-api-core": "0.1.81",
136
+ "@jskit-ai/kernel": "0.1.137",
137
+ "@jskit-ai/resource-crud-core": "0.1.80",
138
+ "@jskit-ai/workspaces-core": "0.1.116"
139
139
  },
140
140
  dev: {}
141
141
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/google-rewarded-core",
3
- "version": "0.1.73",
3
+ "version": "0.1.74",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./shared": "./src/shared/index.js",
@@ -3,18 +3,12 @@ import {
3
3
  recordIdParamsValidator
4
4
  } from "@jskit-ai/kernel/shared/validators";
5
5
  import {
6
- createCrudCursorPaginationQueryValidator,
7
- listSearchQueryValidator,
8
- lookupIncludeQueryValidator,
9
- createCrudParentFilterQueryValidator
6
+ createStandardCrudListQueryValidators,
7
+ createStandardCrudViewQueryValidators
10
8
  } from "@jskit-ai/crud-core/server/listQueryValidators";
11
9
  import { resource } from "../../shared/googleRewardedProviderConfigResource.js";
12
10
  import { workspaceSlugParamsValidator } from "@jskit-ai/workspaces-core/server/validators/routeParamsValidator";
13
11
 
14
- const listCursorPaginationQueryValidator = createCrudCursorPaginationQueryValidator({
15
- orderBy: resource.defaultSort
16
- });
17
- const listParentFilterQueryValidator = createCrudParentFilterQueryValidator(resource);
18
12
  const actionPermissions = Object.freeze({
19
13
  list: "crud.google_rewarded_provider_configs.list",
20
14
  view: "crud.google_rewarded_provider_configs.view",
@@ -33,12 +27,9 @@ function createActions({ surface } = {}) {
33
27
  surfaces: [surface],
34
28
  permission: { require: "all", permissions: [actionPermissions.list] },
35
29
  input: composeSchemaDefinitions([
36
- workspaceSlugParamsValidator,
37
- listCursorPaginationQueryValidator,
38
- listSearchQueryValidator,
39
- listParentFilterQueryValidator,
40
- lookupIncludeQueryValidator,
41
- ]),
30
+ workspaceSlugParamsValidator,
31
+ ...createStandardCrudListQueryValidators({ resource })
32
+ ]),
42
33
  output: null,
43
34
  idempotency: "none",
44
35
  audit: {
@@ -60,10 +51,10 @@ function createActions({ surface } = {}) {
60
51
  surfaces: [surface],
61
52
  permission: { require: "all", permissions: [actionPermissions.view] },
62
53
  input: composeSchemaDefinitions([
63
- workspaceSlugParamsValidator,
64
- recordIdParamsValidator,
65
- lookupIncludeQueryValidator,
66
- ]),
54
+ workspaceSlugParamsValidator,
55
+ recordIdParamsValidator,
56
+ ...createStandardCrudViewQueryValidators()
57
+ ]),
67
58
  output: null,
68
59
  idempotency: "none",
69
60
  audit: {
@@ -71,9 +62,9 @@ function createActions({ surface } = {}) {
71
62
  },
72
63
  observability: {},
73
64
  async execute(input, context, deps) {
74
- return deps.googleRewardedProviderConfigsService.getDocumentById(input.recordId, {
75
- context,
76
- include: input.include
65
+ const { workspaceSlug, recordId, ...query } = input || {};
66
+ return deps.googleRewardedProviderConfigsService.getDocumentById(recordId, query, {
67
+ context
77
68
  });
78
69
  }
79
70
  },
@@ -85,11 +76,11 @@ function createActions({ surface } = {}) {
85
76
  surfaces: [surface],
86
77
  permission: { require: "all", permissions: [actionPermissions.create] },
87
78
  input: composeSchemaDefinitions([
88
- workspaceSlugParamsValidator,
89
- resource.operations.create.body,
90
- ], {
91
- mode: "create"
92
- }),
79
+ workspaceSlugParamsValidator,
80
+ resource.operations.create.body
81
+ ], {
82
+ mode: "create"
83
+ }),
93
84
  output: null,
94
85
  idempotency: "optional",
95
86
  audit: {
@@ -111,10 +102,10 @@ function createActions({ surface } = {}) {
111
102
  surfaces: [surface],
112
103
  permission: { require: "all", permissions: [actionPermissions.update] },
113
104
  input: composeSchemaDefinitions([
114
- workspaceSlugParamsValidator,
115
- recordIdParamsValidator,
116
- resource.operations.patch.body,
117
- ]),
105
+ workspaceSlugParamsValidator,
106
+ recordIdParamsValidator,
107
+ resource.operations.patch.body
108
+ ]),
118
109
  output: null,
119
110
  idempotency: "optional",
120
111
  audit: {
@@ -136,9 +127,9 @@ function createActions({ surface } = {}) {
136
127
  surfaces: [surface],
137
128
  permission: { require: "all", permissions: [actionPermissions.delete] },
138
129
  input: composeSchemaDefinitions([
139
- workspaceSlugParamsValidator,
140
- recordIdParamsValidator,
141
- ]),
130
+ workspaceSlugParamsValidator,
131
+ recordIdParamsValidator
132
+ ]),
142
133
  output: null,
143
134
  idempotency: "optional",
144
135
  audit: {
@@ -3,6 +3,7 @@ import {
3
3
  buildJsonRestQueryParams,
4
4
  createJsonApiInputRecord,
5
5
  createJsonRestContext,
6
+ returnBadRequestWhenJsonRestFieldsetInvalid,
6
7
  returnNullWhenJsonRestResourceMissing
7
8
  } from "@jskit-ai/json-rest-api-core/server/jsonRestApiHost";
8
9
  import { resource } from "../../shared/googleRewardedProviderConfigResource.js";
@@ -12,24 +13,10 @@ function createRepository({ api, knex } = {}) {
12
13
  const withTransaction = createWithTransaction(knex);
13
14
 
14
15
  async function queryDocuments(query = {}, options = {}) {
15
- return api.resources.googleRewardedProviderConfigs.query(
16
- {
17
- queryParams: buildJsonRestQueryParams(JSON_REST_SCOPE_NAME, query),
18
- transaction: options?.trx || null,
19
- simplified: false
20
- },
21
- createJsonRestContext(options?.context || null)
22
- );
23
- }
24
-
25
- async function getDocumentById(recordId, options = {}) {
26
- return returnNullWhenJsonRestResourceMissing(() =>
27
- api.resources.googleRewardedProviderConfigs.get(
16
+ return returnBadRequestWhenJsonRestFieldsetInvalid(() =>
17
+ api.resources.googleRewardedProviderConfigs.query(
28
18
  {
29
- id: recordId,
30
- queryParams: buildJsonRestQueryParams(JSON_REST_SCOPE_NAME, {}, {
31
- include: options?.include
32
- }),
19
+ queryParams: buildJsonRestQueryParams(JSON_REST_SCOPE_NAME, query),
33
20
  transaction: options?.trx || null,
34
21
  simplified: false
35
22
  },
@@ -38,6 +25,22 @@ function createRepository({ api, knex } = {}) {
38
25
  );
39
26
  }
40
27
 
28
+ async function getDocumentById(recordId, query = {}, options = {}) {
29
+ return returnBadRequestWhenJsonRestFieldsetInvalid(() =>
30
+ returnNullWhenJsonRestResourceMissing(() =>
31
+ api.resources.googleRewardedProviderConfigs.get(
32
+ {
33
+ id: recordId,
34
+ queryParams: buildJsonRestQueryParams(JSON_REST_SCOPE_NAME, query),
35
+ transaction: options?.trx || null,
36
+ simplified: false
37
+ },
38
+ createJsonRestContext(options?.context || null)
39
+ )
40
+ )
41
+ );
42
+ }
43
+
41
44
  async function createDocument(payload = {}, options = {}) {
42
45
  return api.resources.googleRewardedProviderConfigs.post(
43
46
  {
@@ -54,7 +57,7 @@ function createRepository({ api, knex } = {}) {
54
57
  async function patchDocumentById(recordId, patch = {}, options = {}) {
55
58
  const sourcePatch = patch && typeof patch === "object" && !Array.isArray(patch) ? patch : {};
56
59
  if (Object.keys(sourcePatch).length < 1) {
57
- return getDocumentById(recordId, options);
60
+ return getDocumentById(recordId, {}, options);
58
61
  }
59
62
 
60
63
  return returnNullWhenJsonRestResourceMissing(() =>
@@ -20,11 +20,10 @@ function createService({ googleRewardedProviderConfigsRepository } = {}) {
20
20
  }));
21
21
  }
22
22
 
23
- async function getDocumentById(recordId, options = {}) {
24
- return returnJsonApiDocument(return404IfNotFound(await googleRewardedProviderConfigsRepository.getDocumentById(recordId, {
23
+ async function getDocumentById(recordId, query = {}, options = {}) {
24
+ return returnJsonApiDocument(return404IfNotFound(await googleRewardedProviderConfigsRepository.getDocumentById(recordId, query, {
25
25
  trx: options?.trx || null,
26
- context: options?.context || null,
27
- include: options?.include
26
+ context: options?.context || null
28
27
  })));
29
28
  }
30
29
 
@@ -3,18 +3,12 @@ import {
3
3
  recordIdParamsValidator
4
4
  } from "@jskit-ai/kernel/shared/validators";
5
5
  import {
6
- createCrudCursorPaginationQueryValidator,
7
- listSearchQueryValidator,
8
- lookupIncludeQueryValidator,
9
- createCrudParentFilterQueryValidator
6
+ createStandardCrudListQueryValidators,
7
+ createStandardCrudViewQueryValidators
10
8
  } from "@jskit-ai/crud-core/server/listQueryValidators";
11
9
  import { resource } from "../../shared/googleRewardedRuleResource.js";
12
10
  import { workspaceSlugParamsValidator } from "@jskit-ai/workspaces-core/server/validators/routeParamsValidator";
13
11
 
14
- const listCursorPaginationQueryValidator = createCrudCursorPaginationQueryValidator({
15
- orderBy: resource.defaultSort
16
- });
17
- const listParentFilterQueryValidator = createCrudParentFilterQueryValidator(resource);
18
12
  const actionPermissions = Object.freeze({
19
13
  list: "crud.google_rewarded_rules.list",
20
14
  view: "crud.google_rewarded_rules.view",
@@ -33,12 +27,9 @@ function createActions({ surface } = {}) {
33
27
  surfaces: [surface],
34
28
  permission: { require: "all", permissions: [actionPermissions.list] },
35
29
  input: composeSchemaDefinitions([
36
- workspaceSlugParamsValidator,
37
- listCursorPaginationQueryValidator,
38
- listSearchQueryValidator,
39
- listParentFilterQueryValidator,
40
- lookupIncludeQueryValidator,
41
- ]),
30
+ workspaceSlugParamsValidator,
31
+ ...createStandardCrudListQueryValidators({ resource })
32
+ ]),
42
33
  output: null,
43
34
  idempotency: "none",
44
35
  audit: {
@@ -60,10 +51,10 @@ function createActions({ surface } = {}) {
60
51
  surfaces: [surface],
61
52
  permission: { require: "all", permissions: [actionPermissions.view] },
62
53
  input: composeSchemaDefinitions([
63
- workspaceSlugParamsValidator,
64
- recordIdParamsValidator,
65
- lookupIncludeQueryValidator,
66
- ]),
54
+ workspaceSlugParamsValidator,
55
+ recordIdParamsValidator,
56
+ ...createStandardCrudViewQueryValidators()
57
+ ]),
67
58
  output: null,
68
59
  idempotency: "none",
69
60
  audit: {
@@ -71,9 +62,9 @@ function createActions({ surface } = {}) {
71
62
  },
72
63
  observability: {},
73
64
  async execute(input, context, deps) {
74
- return deps.googleRewardedRulesService.getDocumentById(input.recordId, {
75
- context,
76
- include: input.include
65
+ const { workspaceSlug, recordId, ...query } = input || {};
66
+ return deps.googleRewardedRulesService.getDocumentById(recordId, query, {
67
+ context
77
68
  });
78
69
  }
79
70
  },
@@ -85,11 +76,11 @@ function createActions({ surface } = {}) {
85
76
  surfaces: [surface],
86
77
  permission: { require: "all", permissions: [actionPermissions.create] },
87
78
  input: composeSchemaDefinitions([
88
- workspaceSlugParamsValidator,
89
- resource.operations.create.body,
90
- ], {
91
- mode: "create"
92
- }),
79
+ workspaceSlugParamsValidator,
80
+ resource.operations.create.body
81
+ ], {
82
+ mode: "create"
83
+ }),
93
84
  output: null,
94
85
  idempotency: "optional",
95
86
  audit: {
@@ -111,10 +102,10 @@ function createActions({ surface } = {}) {
111
102
  surfaces: [surface],
112
103
  permission: { require: "all", permissions: [actionPermissions.update] },
113
104
  input: composeSchemaDefinitions([
114
- workspaceSlugParamsValidator,
115
- recordIdParamsValidator,
116
- resource.operations.patch.body,
117
- ]),
105
+ workspaceSlugParamsValidator,
106
+ recordIdParamsValidator,
107
+ resource.operations.patch.body
108
+ ]),
118
109
  output: null,
119
110
  idempotency: "optional",
120
111
  audit: {
@@ -136,9 +127,9 @@ function createActions({ surface } = {}) {
136
127
  surfaces: [surface],
137
128
  permission: { require: "all", permissions: [actionPermissions.delete] },
138
129
  input: composeSchemaDefinitions([
139
- workspaceSlugParamsValidator,
140
- recordIdParamsValidator,
141
- ]),
130
+ workspaceSlugParamsValidator,
131
+ recordIdParamsValidator
132
+ ]),
142
133
  output: null,
143
134
  idempotency: "optional",
144
135
  audit: {
@@ -3,6 +3,7 @@ import {
3
3
  buildJsonRestQueryParams,
4
4
  createJsonApiInputRecord,
5
5
  createJsonRestContext,
6
+ returnBadRequestWhenJsonRestFieldsetInvalid,
6
7
  returnNullWhenJsonRestResourceMissing
7
8
  } from "@jskit-ai/json-rest-api-core/server/jsonRestApiHost";
8
9
  import { resource } from "../../shared/googleRewardedRuleResource.js";
@@ -12,24 +13,10 @@ function createRepository({ api, knex } = {}) {
12
13
  const withTransaction = createWithTransaction(knex);
13
14
 
14
15
  async function queryDocuments(query = {}, options = {}) {
15
- return api.resources.googleRewardedRules.query(
16
- {
17
- queryParams: buildJsonRestQueryParams(JSON_REST_SCOPE_NAME, query),
18
- transaction: options?.trx || null,
19
- simplified: false
20
- },
21
- createJsonRestContext(options?.context || null)
22
- );
23
- }
24
-
25
- async function getDocumentById(recordId, options = {}) {
26
- return returnNullWhenJsonRestResourceMissing(() =>
27
- api.resources.googleRewardedRules.get(
16
+ return returnBadRequestWhenJsonRestFieldsetInvalid(() =>
17
+ api.resources.googleRewardedRules.query(
28
18
  {
29
- id: recordId,
30
- queryParams: buildJsonRestQueryParams(JSON_REST_SCOPE_NAME, {}, {
31
- include: options?.include
32
- }),
19
+ queryParams: buildJsonRestQueryParams(JSON_REST_SCOPE_NAME, query),
33
20
  transaction: options?.trx || null,
34
21
  simplified: false
35
22
  },
@@ -38,6 +25,22 @@ function createRepository({ api, knex } = {}) {
38
25
  );
39
26
  }
40
27
 
28
+ async function getDocumentById(recordId, query = {}, options = {}) {
29
+ return returnBadRequestWhenJsonRestFieldsetInvalid(() =>
30
+ returnNullWhenJsonRestResourceMissing(() =>
31
+ api.resources.googleRewardedRules.get(
32
+ {
33
+ id: recordId,
34
+ queryParams: buildJsonRestQueryParams(JSON_REST_SCOPE_NAME, query),
35
+ transaction: options?.trx || null,
36
+ simplified: false
37
+ },
38
+ createJsonRestContext(options?.context || null)
39
+ )
40
+ )
41
+ );
42
+ }
43
+
41
44
  async function createDocument(payload = {}, options = {}) {
42
45
  return api.resources.googleRewardedRules.post(
43
46
  {
@@ -54,7 +57,7 @@ function createRepository({ api, knex } = {}) {
54
57
  async function patchDocumentById(recordId, patch = {}, options = {}) {
55
58
  const sourcePatch = patch && typeof patch === "object" && !Array.isArray(patch) ? patch : {};
56
59
  if (Object.keys(sourcePatch).length < 1) {
57
- return getDocumentById(recordId, options);
60
+ return getDocumentById(recordId, {}, options);
58
61
  }
59
62
 
60
63
  return returnNullWhenJsonRestResourceMissing(() =>
@@ -20,11 +20,10 @@ function createService({ googleRewardedRulesRepository } = {}) {
20
20
  }));
21
21
  }
22
22
 
23
- async function getDocumentById(recordId, options = {}) {
24
- return returnJsonApiDocument(return404IfNotFound(await googleRewardedRulesRepository.getDocumentById(recordId, {
23
+ async function getDocumentById(recordId, query = {}, options = {}) {
24
+ return returnJsonApiDocument(return404IfNotFound(await googleRewardedRulesRepository.getDocumentById(recordId, query, {
25
25
  trx: options?.trx || null,
26
- context: options?.context || null,
27
- include: options?.include
26
+ context: options?.context || null
28
27
  })));
29
28
  }
30
29
 
@@ -416,7 +416,7 @@ function createService({
416
416
  }
417
417
 
418
418
  return googleRewardedWatchSessionsRepository.withTransaction(async (trx) => {
419
- const sessionRecord = normalizeRecord(await googleRewardedWatchSessionsRepository.getDocumentById(sessionId, {
419
+ const sessionRecord = normalizeRecord(await googleRewardedWatchSessionsRepository.getDocumentById(sessionId, {}, {
420
420
  context: options?.context || null,
421
421
  trx
422
422
  }));
@@ -503,7 +503,7 @@ function createService({
503
503
  throw new AppError(400, "sessionId is required.");
504
504
  }
505
505
 
506
- const sessionRecord = normalizeRecord(await googleRewardedWatchSessionsRepository.getDocumentById(sessionId, {
506
+ const sessionRecord = normalizeRecord(await googleRewardedWatchSessionsRepository.getDocumentById(sessionId, {}, {
507
507
  context: options?.context || null,
508
508
  trx: options?.trx || null
509
509
  }));
@@ -3,18 +3,12 @@ import {
3
3
  recordIdParamsValidator
4
4
  } from "@jskit-ai/kernel/shared/validators";
5
5
  import {
6
- createCrudCursorPaginationQueryValidator,
7
- listSearchQueryValidator,
8
- lookupIncludeQueryValidator,
9
- createCrudParentFilterQueryValidator
6
+ createStandardCrudListQueryValidators,
7
+ createStandardCrudViewQueryValidators
10
8
  } from "@jskit-ai/crud-core/server/listQueryValidators";
11
9
  import { resource } from "../../shared/googleRewardedUnlockReceiptResource.js";
12
10
  import { workspaceSlugParamsValidator } from "@jskit-ai/workspaces-core/server/validators/routeParamsValidator";
13
11
 
14
- const listCursorPaginationQueryValidator = createCrudCursorPaginationQueryValidator({
15
- orderBy: resource.defaultSort
16
- });
17
- const listParentFilterQueryValidator = createCrudParentFilterQueryValidator(resource);
18
12
  const actionPermissions = Object.freeze({
19
13
  list: "crud.google_rewarded_unlock_receipts.list",
20
14
  view: "crud.google_rewarded_unlock_receipts.view",
@@ -33,12 +27,9 @@ function createActions({ surface } = {}) {
33
27
  surfaces: [surface],
34
28
  permission: { require: "all", permissions: [actionPermissions.list] },
35
29
  input: composeSchemaDefinitions([
36
- workspaceSlugParamsValidator,
37
- listCursorPaginationQueryValidator,
38
- listSearchQueryValidator,
39
- listParentFilterQueryValidator,
40
- lookupIncludeQueryValidator,
41
- ]),
30
+ workspaceSlugParamsValidator,
31
+ ...createStandardCrudListQueryValidators({ resource })
32
+ ]),
42
33
  output: null,
43
34
  idempotency: "none",
44
35
  audit: {
@@ -60,10 +51,10 @@ function createActions({ surface } = {}) {
60
51
  surfaces: [surface],
61
52
  permission: { require: "all", permissions: [actionPermissions.view] },
62
53
  input: composeSchemaDefinitions([
63
- workspaceSlugParamsValidator,
64
- recordIdParamsValidator,
65
- lookupIncludeQueryValidator,
66
- ]),
54
+ workspaceSlugParamsValidator,
55
+ recordIdParamsValidator,
56
+ ...createStandardCrudViewQueryValidators()
57
+ ]),
67
58
  output: null,
68
59
  idempotency: "none",
69
60
  audit: {
@@ -71,9 +62,9 @@ function createActions({ surface } = {}) {
71
62
  },
72
63
  observability: {},
73
64
  async execute(input, context, deps) {
74
- return deps.googleRewardedUnlockReceiptsService.getDocumentById(input.recordId, {
75
- context,
76
- include: input.include
65
+ const { workspaceSlug, recordId, ...query } = input || {};
66
+ return deps.googleRewardedUnlockReceiptsService.getDocumentById(recordId, query, {
67
+ context
77
68
  });
78
69
  }
79
70
  },
@@ -85,11 +76,11 @@ function createActions({ surface } = {}) {
85
76
  surfaces: [surface],
86
77
  permission: { require: "all", permissions: [actionPermissions.create] },
87
78
  input: composeSchemaDefinitions([
88
- workspaceSlugParamsValidator,
89
- resource.operations.create.body,
90
- ], {
91
- mode: "create"
92
- }),
79
+ workspaceSlugParamsValidator,
80
+ resource.operations.create.body
81
+ ], {
82
+ mode: "create"
83
+ }),
93
84
  output: null,
94
85
  idempotency: "optional",
95
86
  audit: {
@@ -111,10 +102,10 @@ function createActions({ surface } = {}) {
111
102
  surfaces: [surface],
112
103
  permission: { require: "all", permissions: [actionPermissions.update] },
113
104
  input: composeSchemaDefinitions([
114
- workspaceSlugParamsValidator,
115
- recordIdParamsValidator,
116
- resource.operations.patch.body,
117
- ]),
105
+ workspaceSlugParamsValidator,
106
+ recordIdParamsValidator,
107
+ resource.operations.patch.body
108
+ ]),
118
109
  output: null,
119
110
  idempotency: "optional",
120
111
  audit: {
@@ -136,9 +127,9 @@ function createActions({ surface } = {}) {
136
127
  surfaces: [surface],
137
128
  permission: { require: "all", permissions: [actionPermissions.delete] },
138
129
  input: composeSchemaDefinitions([
139
- workspaceSlugParamsValidator,
140
- recordIdParamsValidator,
141
- ]),
130
+ workspaceSlugParamsValidator,
131
+ recordIdParamsValidator
132
+ ]),
142
133
  output: null,
143
134
  idempotency: "optional",
144
135
  audit: {
@@ -3,6 +3,7 @@ import {
3
3
  buildJsonRestQueryParams,
4
4
  createJsonApiInputRecord,
5
5
  createJsonRestContext,
6
+ returnBadRequestWhenJsonRestFieldsetInvalid,
6
7
  returnNullWhenJsonRestResourceMissing
7
8
  } from "@jskit-ai/json-rest-api-core/server/jsonRestApiHost";
8
9
  import { resource } from "../../shared/googleRewardedUnlockReceiptResource.js";
@@ -12,24 +13,10 @@ function createRepository({ api, knex } = {}) {
12
13
  const withTransaction = createWithTransaction(knex);
13
14
 
14
15
  async function queryDocuments(query = {}, options = {}) {
15
- return api.resources.googleRewardedUnlockReceipts.query(
16
- {
17
- queryParams: buildJsonRestQueryParams(JSON_REST_SCOPE_NAME, query),
18
- transaction: options?.trx || null,
19
- simplified: false
20
- },
21
- createJsonRestContext(options?.context || null)
22
- );
23
- }
24
-
25
- async function getDocumentById(recordId, options = {}) {
26
- return returnNullWhenJsonRestResourceMissing(() =>
27
- api.resources.googleRewardedUnlockReceipts.get(
16
+ return returnBadRequestWhenJsonRestFieldsetInvalid(() =>
17
+ api.resources.googleRewardedUnlockReceipts.query(
28
18
  {
29
- id: recordId,
30
- queryParams: buildJsonRestQueryParams(JSON_REST_SCOPE_NAME, {}, {
31
- include: options?.include
32
- }),
19
+ queryParams: buildJsonRestQueryParams(JSON_REST_SCOPE_NAME, query),
33
20
  transaction: options?.trx || null,
34
21
  simplified: false
35
22
  },
@@ -38,6 +25,22 @@ function createRepository({ api, knex } = {}) {
38
25
  );
39
26
  }
40
27
 
28
+ async function getDocumentById(recordId, query = {}, options = {}) {
29
+ return returnBadRequestWhenJsonRestFieldsetInvalid(() =>
30
+ returnNullWhenJsonRestResourceMissing(() =>
31
+ api.resources.googleRewardedUnlockReceipts.get(
32
+ {
33
+ id: recordId,
34
+ queryParams: buildJsonRestQueryParams(JSON_REST_SCOPE_NAME, query),
35
+ transaction: options?.trx || null,
36
+ simplified: false
37
+ },
38
+ createJsonRestContext(options?.context || null)
39
+ )
40
+ )
41
+ );
42
+ }
43
+
41
44
  async function createDocument(payload = {}, options = {}) {
42
45
  return api.resources.googleRewardedUnlockReceipts.post(
43
46
  {
@@ -54,7 +57,7 @@ function createRepository({ api, knex } = {}) {
54
57
  async function patchDocumentById(recordId, patch = {}, options = {}) {
55
58
  const sourcePatch = patch && typeof patch === "object" && !Array.isArray(patch) ? patch : {};
56
59
  if (Object.keys(sourcePatch).length < 1) {
57
- return getDocumentById(recordId, options);
60
+ return getDocumentById(recordId, {}, options);
58
61
  }
59
62
 
60
63
  return returnNullWhenJsonRestResourceMissing(() =>
@@ -20,11 +20,10 @@ function createService({ googleRewardedUnlockReceiptsRepository } = {}) {
20
20
  }));
21
21
  }
22
22
 
23
- async function getDocumentById(recordId, options = {}) {
24
- return returnJsonApiDocument(return404IfNotFound(await googleRewardedUnlockReceiptsRepository.getDocumentById(recordId, {
23
+ async function getDocumentById(recordId, query = {}, options = {}) {
24
+ return returnJsonApiDocument(return404IfNotFound(await googleRewardedUnlockReceiptsRepository.getDocumentById(recordId, query, {
25
25
  trx: options?.trx || null,
26
- context: options?.context || null,
27
- include: options?.include
26
+ context: options?.context || null
28
27
  })));
29
28
  }
30
29
 
@@ -3,18 +3,12 @@ import {
3
3
  recordIdParamsValidator
4
4
  } from "@jskit-ai/kernel/shared/validators";
5
5
  import {
6
- createCrudCursorPaginationQueryValidator,
7
- listSearchQueryValidator,
8
- lookupIncludeQueryValidator,
9
- createCrudParentFilterQueryValidator
6
+ createStandardCrudListQueryValidators,
7
+ createStandardCrudViewQueryValidators
10
8
  } from "@jskit-ai/crud-core/server/listQueryValidators";
11
9
  import { resource } from "../../shared/googleRewardedWatchSessionResource.js";
12
10
  import { workspaceSlugParamsValidator } from "@jskit-ai/workspaces-core/server/validators/routeParamsValidator";
13
11
 
14
- const listCursorPaginationQueryValidator = createCrudCursorPaginationQueryValidator({
15
- orderBy: resource.defaultSort
16
- });
17
- const listParentFilterQueryValidator = createCrudParentFilterQueryValidator(resource);
18
12
  const actionPermissions = Object.freeze({
19
13
  list: "crud.google_rewarded_watch_sessions.list",
20
14
  view: "crud.google_rewarded_watch_sessions.view",
@@ -33,12 +27,9 @@ function createActions({ surface } = {}) {
33
27
  surfaces: [surface],
34
28
  permission: { require: "all", permissions: [actionPermissions.list] },
35
29
  input: composeSchemaDefinitions([
36
- workspaceSlugParamsValidator,
37
- listCursorPaginationQueryValidator,
38
- listSearchQueryValidator,
39
- listParentFilterQueryValidator,
40
- lookupIncludeQueryValidator,
41
- ]),
30
+ workspaceSlugParamsValidator,
31
+ ...createStandardCrudListQueryValidators({ resource })
32
+ ]),
42
33
  output: null,
43
34
  idempotency: "none",
44
35
  audit: {
@@ -60,10 +51,10 @@ function createActions({ surface } = {}) {
60
51
  surfaces: [surface],
61
52
  permission: { require: "all", permissions: [actionPermissions.view] },
62
53
  input: composeSchemaDefinitions([
63
- workspaceSlugParamsValidator,
64
- recordIdParamsValidator,
65
- lookupIncludeQueryValidator,
66
- ]),
54
+ workspaceSlugParamsValidator,
55
+ recordIdParamsValidator,
56
+ ...createStandardCrudViewQueryValidators()
57
+ ]),
67
58
  output: null,
68
59
  idempotency: "none",
69
60
  audit: {
@@ -71,9 +62,9 @@ function createActions({ surface } = {}) {
71
62
  },
72
63
  observability: {},
73
64
  async execute(input, context, deps) {
74
- return deps.googleRewardedWatchSessionsService.getDocumentById(input.recordId, {
75
- context,
76
- include: input.include
65
+ const { workspaceSlug, recordId, ...query } = input || {};
66
+ return deps.googleRewardedWatchSessionsService.getDocumentById(recordId, query, {
67
+ context
77
68
  });
78
69
  }
79
70
  },
@@ -85,11 +76,11 @@ function createActions({ surface } = {}) {
85
76
  surfaces: [surface],
86
77
  permission: { require: "all", permissions: [actionPermissions.create] },
87
78
  input: composeSchemaDefinitions([
88
- workspaceSlugParamsValidator,
89
- resource.operations.create.body,
90
- ], {
91
- mode: "create"
92
- }),
79
+ workspaceSlugParamsValidator,
80
+ resource.operations.create.body
81
+ ], {
82
+ mode: "create"
83
+ }),
93
84
  output: null,
94
85
  idempotency: "optional",
95
86
  audit: {
@@ -111,10 +102,10 @@ function createActions({ surface } = {}) {
111
102
  surfaces: [surface],
112
103
  permission: { require: "all", permissions: [actionPermissions.update] },
113
104
  input: composeSchemaDefinitions([
114
- workspaceSlugParamsValidator,
115
- recordIdParamsValidator,
116
- resource.operations.patch.body,
117
- ]),
105
+ workspaceSlugParamsValidator,
106
+ recordIdParamsValidator,
107
+ resource.operations.patch.body
108
+ ]),
118
109
  output: null,
119
110
  idempotency: "optional",
120
111
  audit: {
@@ -136,9 +127,9 @@ function createActions({ surface } = {}) {
136
127
  surfaces: [surface],
137
128
  permission: { require: "all", permissions: [actionPermissions.delete] },
138
129
  input: composeSchemaDefinitions([
139
- workspaceSlugParamsValidator,
140
- recordIdParamsValidator,
141
- ]),
130
+ workspaceSlugParamsValidator,
131
+ recordIdParamsValidator
132
+ ]),
142
133
  output: null,
143
134
  idempotency: "optional",
144
135
  audit: {
@@ -3,6 +3,7 @@ import {
3
3
  buildJsonRestQueryParams,
4
4
  createJsonApiInputRecord,
5
5
  createJsonRestContext,
6
+ returnBadRequestWhenJsonRestFieldsetInvalid,
6
7
  returnNullWhenJsonRestResourceMissing
7
8
  } from "@jskit-ai/json-rest-api-core/server/jsonRestApiHost";
8
9
  import { resource } from "../../shared/googleRewardedWatchSessionResource.js";
@@ -12,24 +13,10 @@ function createRepository({ api, knex } = {}) {
12
13
  const withTransaction = createWithTransaction(knex);
13
14
 
14
15
  async function queryDocuments(query = {}, options = {}) {
15
- return api.resources.googleRewardedWatchSessions.query(
16
- {
17
- queryParams: buildJsonRestQueryParams(JSON_REST_SCOPE_NAME, query),
18
- transaction: options?.trx || null,
19
- simplified: false
20
- },
21
- createJsonRestContext(options?.context || null)
22
- );
23
- }
24
-
25
- async function getDocumentById(recordId, options = {}) {
26
- return returnNullWhenJsonRestResourceMissing(() =>
27
- api.resources.googleRewardedWatchSessions.get(
16
+ return returnBadRequestWhenJsonRestFieldsetInvalid(() =>
17
+ api.resources.googleRewardedWatchSessions.query(
28
18
  {
29
- id: recordId,
30
- queryParams: buildJsonRestQueryParams(JSON_REST_SCOPE_NAME, {}, {
31
- include: options?.include
32
- }),
19
+ queryParams: buildJsonRestQueryParams(JSON_REST_SCOPE_NAME, query),
33
20
  transaction: options?.trx || null,
34
21
  simplified: false
35
22
  },
@@ -38,6 +25,22 @@ function createRepository({ api, knex } = {}) {
38
25
  );
39
26
  }
40
27
 
28
+ async function getDocumentById(recordId, query = {}, options = {}) {
29
+ return returnBadRequestWhenJsonRestFieldsetInvalid(() =>
30
+ returnNullWhenJsonRestResourceMissing(() =>
31
+ api.resources.googleRewardedWatchSessions.get(
32
+ {
33
+ id: recordId,
34
+ queryParams: buildJsonRestQueryParams(JSON_REST_SCOPE_NAME, query),
35
+ transaction: options?.trx || null,
36
+ simplified: false
37
+ },
38
+ createJsonRestContext(options?.context || null)
39
+ )
40
+ )
41
+ );
42
+ }
43
+
41
44
  async function createDocument(payload = {}, options = {}) {
42
45
  return api.resources.googleRewardedWatchSessions.post(
43
46
  {
@@ -54,7 +57,7 @@ function createRepository({ api, knex } = {}) {
54
57
  async function patchDocumentById(recordId, patch = {}, options = {}) {
55
58
  const sourcePatch = patch && typeof patch === "object" && !Array.isArray(patch) ? patch : {};
56
59
  if (Object.keys(sourcePatch).length < 1) {
57
- return getDocumentById(recordId, options);
60
+ return getDocumentById(recordId, {}, options);
58
61
  }
59
62
 
60
63
  return returnNullWhenJsonRestResourceMissing(() =>
@@ -20,11 +20,10 @@ function createService({ googleRewardedWatchSessionsRepository } = {}) {
20
20
  }));
21
21
  }
22
22
 
23
- async function getDocumentById(recordId, options = {}) {
24
- return returnJsonApiDocument(return404IfNotFound(await googleRewardedWatchSessionsRepository.getDocumentById(recordId, {
23
+ async function getDocumentById(recordId, query = {}, options = {}) {
24
+ return returnJsonApiDocument(return404IfNotFound(await googleRewardedWatchSessionsRepository.getDocumentById(recordId, query, {
25
25
  trx: options?.trx || null,
26
- context: options?.context || null,
27
- include: options?.include
26
+ context: options?.context || null
28
27
  })));
29
28
  }
30
29