@corva/create-app 0.48.0-0 → 0.48.0-1

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 (120) hide show
  1. package/common/python/.env +0 -9
  2. package/common/python/.env.sample +1 -17
  3. package/common/python/requirements.txt +1 -1
  4. package/lib/constants/manifest.js +13 -1
  5. package/lib/constants/package.js +20 -10
  6. package/lib/flows/lib/manifest.js +31 -0
  7. package/lib/helpers/manifest.js +6 -9
  8. package/lib/helpers/resolve-app-runtime.js +24 -0
  9. package/lib/main.js +36 -31
  10. package/package.json +2 -1
  11. package/templates/{javascript/scheduler → scheduler_data-time/javascript}/README.md +0 -0
  12. package/templates/scheduler_data-time/javascript/__test__/processor.spec.js +15 -0
  13. package/templates/scheduler_data-time/javascript/index.js +15 -0
  14. package/templates/{python/scheduler → scheduler_data-time/python}/README.md +0 -0
  15. package/templates/{python/scheduler → scheduler_data-time/python}/lambda_function.py +0 -0
  16. package/templates/{python/scheduler → scheduler_data-time/python}/test/__init__.py +0 -0
  17. package/templates/{python/scheduler → scheduler_data-time/python}/test/app_test.py +0 -0
  18. package/templates/{typescript/scheduler → scheduler_data-time/typescript}/README.md +0 -0
  19. package/templates/scheduler_data-time/typescript/__test__/processor.spec.ts +15 -0
  20. package/templates/scheduler_data-time/typescript/index.ts +8 -0
  21. package/templates/scheduler_depth/javascript/README.md +19 -0
  22. package/templates/scheduler_depth/javascript/__test__/processor.spec.js +17 -0
  23. package/templates/scheduler_depth/javascript/index.js +15 -0
  24. package/templates/scheduler_depth/python/README.md +31 -0
  25. package/templates/scheduler_depth/python/lambda_function.py +7 -0
  26. package/templates/{python/stream → scheduler_depth/python}/test/__init__.py +0 -0
  27. package/templates/scheduler_depth/python/test/app_test.py +10 -0
  28. package/templates/scheduler_depth/typescript/README.md +25 -0
  29. package/templates/scheduler_depth/typescript/__test__/processor.spec.ts +17 -0
  30. package/templates/scheduler_depth/typescript/index.ts +8 -0
  31. package/templates/scheduler_natural-time/javascript/README.md +19 -0
  32. package/templates/scheduler_natural-time/javascript/__test__/processor.spec.js +15 -0
  33. package/templates/scheduler_natural-time/javascript/index.js +15 -0
  34. package/templates/scheduler_natural-time/python/README.md +31 -0
  35. package/templates/scheduler_natural-time/python/lambda_function.py +7 -0
  36. package/templates/{python/task → scheduler_natural-time/python}/test/__init__.py +0 -0
  37. package/templates/scheduler_natural-time/python/test/app_test.py +10 -0
  38. package/templates/scheduler_natural-time/typescript/README.md +25 -0
  39. package/templates/scheduler_natural-time/typescript/__test__/processor.spec.ts +15 -0
  40. package/templates/scheduler_natural-time/typescript/index.ts +8 -0
  41. package/templates/{javascript/stream → stream_depth/javascript}/README.md +0 -0
  42. package/templates/stream_depth/javascript/__test__/processor.spec.js +20 -0
  43. package/templates/stream_depth/javascript/index.js +14 -0
  44. package/templates/{python/stream → stream_depth/python}/README.md +0 -0
  45. package/templates/stream_depth/python/lambda_function.py +7 -0
  46. package/templates/stream_depth/python/test/__init__.py +0 -0
  47. package/templates/stream_depth/python/test/app_test.py +16 -0
  48. package/templates/{typescript/stream → stream_depth/typescript}/README.md +0 -0
  49. package/templates/stream_depth/typescript/__test__/processor.spec.ts +20 -0
  50. package/templates/stream_depth/typescript/index.ts +8 -0
  51. package/templates/stream_time/javascript/README.md +19 -0
  52. package/templates/stream_time/javascript/__test__/processor.spec.js +14 -0
  53. package/templates/stream_time/javascript/index.js +14 -0
  54. package/templates/stream_time/python/README.md +31 -0
  55. package/templates/{python/stream → stream_time/python}/lambda_function.py +0 -0
  56. package/templates/stream_time/python/test/__init__.py +0 -0
  57. package/templates/{python/stream → stream_time/python}/test/app_test.py +0 -0
  58. package/templates/stream_time/typescript/README.md +25 -0
  59. package/templates/stream_time/typescript/__test__/processor.spec.ts +14 -0
  60. package/templates/stream_time/typescript/index.ts +8 -0
  61. package/templates/{javascript/task → task/javascript}/README.md +0 -0
  62. package/templates/task/javascript/__test__/processor.spec.js +16 -0
  63. package/templates/task/javascript/index.js +15 -0
  64. package/templates/{python/task → task/python}/README.md +0 -0
  65. package/templates/{python/task → task/python}/lambda_function.py +0 -0
  66. package/templates/task/python/test/__init__.py +0 -0
  67. package/templates/{python/task → task/python}/test/app_test.py +1 -1
  68. package/templates/{typescript/task → task/typescript}/README.md +0 -0
  69. package/templates/task/typescript/__test__/processor.spec.ts +16 -0
  70. package/templates/task/typescript/index.ts +8 -0
  71. package/templates/{javascript/ui → ui/javascript}/.env +0 -0
  72. package/templates/{javascript/ui → ui/javascript}/.env.sample +0 -0
  73. package/templates/{javascript/ui → ui/javascript}/.eslintrc +0 -0
  74. package/templates/{javascript/ui → ui/javascript}/.prettierrc +0 -0
  75. package/templates/{javascript/ui → ui/javascript}/README.md +0 -0
  76. package/templates/{javascript/ui → ui/javascript}/config-overrides.js +0 -0
  77. package/templates/{javascript/ui → ui/javascript}/gitignore +0 -0
  78. package/templates/{javascript/ui → ui/javascript}/src/App.css +0 -0
  79. package/templates/{javascript/ui → ui/javascript}/src/App.js +0 -0
  80. package/templates/{javascript/ui → ui/javascript}/src/AppSettings.js +0 -0
  81. package/templates/{javascript/ui → ui/javascript}/src/__tests__/TestExample.test.js +0 -0
  82. package/templates/{javascript/ui → ui/javascript}/src/assets/logo.svg +0 -0
  83. package/templates/{javascript/ui → ui/javascript}/src/constants.js +0 -0
  84. package/templates/{javascript/ui → ui/javascript}/src/index.js +0 -0
  85. package/templates/{javascript/ui → ui/javascript}/src/setupTests.js +0 -0
  86. package/templates/{typescript/ui → ui/typescript}/.env +0 -0
  87. package/templates/{typescript/ui → ui/typescript}/.env.sample +0 -0
  88. package/templates/{typescript/ui → ui/typescript}/.eslintrc +0 -0
  89. package/templates/{typescript/ui → ui/typescript}/.prettierrc +0 -0
  90. package/templates/{typescript/ui → ui/typescript}/README.md +0 -0
  91. package/templates/{typescript/ui → ui/typescript}/config-overrides.js +0 -0
  92. package/templates/{typescript/ui → ui/typescript}/gitignore +0 -0
  93. package/templates/{typescript/ui → ui/typescript}/src/App.css +0 -0
  94. package/templates/{typescript/ui → ui/typescript}/src/App.tsx +0 -0
  95. package/templates/{typescript/ui → ui/typescript}/src/AppSettings.tsx +0 -0
  96. package/templates/{typescript/ui → ui/typescript}/src/__tests__/TestExample.test.tsx +0 -0
  97. package/templates/{typescript/ui → ui/typescript}/src/assets/logo.svg +0 -0
  98. package/templates/{typescript/ui → ui/typescript}/src/constants.ts +0 -0
  99. package/templates/{typescript/ui → ui/typescript}/src/custom.d.ts +0 -0
  100. package/templates/{typescript/ui → ui/typescript}/src/index.js +0 -0
  101. package/templates/{typescript/ui → ui/typescript}/src/setupTests.ts +0 -0
  102. package/templates/{typescript/ui → ui/typescript}/tsconfig.json +0 -0
  103. package/templates/javascript/scheduler/__test__/processor.test.js +0 -19
  104. package/templates/javascript/scheduler/index.js +0 -15
  105. package/templates/javascript/scheduler/src/processor.js +0 -17
  106. package/templates/javascript/stream/__test__/processor.test.js +0 -44
  107. package/templates/javascript/stream/index.js +0 -15
  108. package/templates/javascript/stream/src/processor.js +0 -18
  109. package/templates/javascript/task/__test__/processor.test.js +0 -18
  110. package/templates/javascript/task/index.js +0 -16
  111. package/templates/javascript/task/src/processor.js +0 -17
  112. package/templates/typescript/scheduler/__test__/processor.spec.ts +0 -20
  113. package/templates/typescript/scheduler/index.ts +0 -8
  114. package/templates/typescript/scheduler/lib/processor.ts +0 -14
  115. package/templates/typescript/stream/__test__/processor.spec.ts +0 -43
  116. package/templates/typescript/stream/index.ts +0 -8
  117. package/templates/typescript/stream/lib/processor.ts +0 -16
  118. package/templates/typescript/task/__test__/processor.spec.ts +0 -27
  119. package/templates/typescript/task/index.ts +0 -8
  120. package/templates/typescript/task/src/processor.ts +0 -14
@@ -1,18 +0,0 @@
1
- class Processor {
2
- constructor({ apiClient, logger }) {
3
- this.apiClient = apiClient;
4
- this.logger = logger;
5
- }
6
-
7
- async process({ event }) {
8
- const { asset_id, records } = event;
9
-
10
- if (!records.length) {
11
- return;
12
- }
13
-
14
- this.logger.info(`Processing event. Asset: ${asset_id}. Received ${records.length} records.`);
15
- }
16
- }
17
-
18
- module.exports = Processor;
@@ -1,18 +0,0 @@
1
- const Processor = require('../src/processor');
2
-
3
- test('process event', async () => {
4
- const fakeLogger = console;
5
- const fakeApiClient = {};
6
-
7
- const event = {
8
- asset_id: 123,
9
- company_id: 1234,
10
- properties: {
11
- foo: 'bar',
12
- },
13
- };
14
-
15
- const processor = new Processor({ logger: fakeLogger, apiClient: fakeApiClient });
16
-
17
- await processor.process({ event });
18
- });
@@ -1,16 +0,0 @@
1
- const { Corva } = require('@corva/node-sdk');
2
- const Processor = require('./src/processor');
3
-
4
- /**
5
- * @param {import('@corva/node-sdk').Task} event
6
- * @param {import('@corva/node-sdk').HandlerContext} context
7
- */
8
- exports.handler = new Corva().task((event, context) => {
9
- const processor = new Processor({
10
- apiClient: context.api,
11
- logger: context.logger,
12
- config: context.config,
13
- });
14
-
15
- return processor.process({ event });
16
- });
@@ -1,17 +0,0 @@
1
- class Processor {
2
- constructor({ apiClient, logger, config }) {
3
- this.apiClient = apiClient;
4
- this.logger = logger;
5
- }
6
-
7
- async process({ event }) {
8
- this.logger.debug({ event }, 'Event');
9
-
10
- // eslint-disable-next-line no-unused-vars
11
- const { asset_id: assetId, company_id: companyId } = event;
12
-
13
- this.logger.info(`Processing event. Asset: ${assetId}`);
14
- }
15
- }
16
-
17
- module.exports = Processor;
@@ -1,20 +0,0 @@
1
- import { Processor } from '../lib/processor';
2
- import type { HandlerContext, ScheduledLambdaEvent } from '@corva/node-sdk';
3
-
4
- test('process event', async () => {
5
- const fakeLogger = console as unknown as HandlerContext['logger'];
6
- const fakeApiClient = {} as unknown as HandlerContext['api'];
7
-
8
- const event = {
9
- company: 1,
10
- asset_id: 1234,
11
- schedule: 206977482,
12
- interval: 300,
13
- schedule_start: 157829100000,
14
- schedule_end: 157829400000,
15
- } as unknown as ScheduledLambdaEvent<any>;
16
-
17
- const processor = new Processor(fakeApiClient, fakeLogger);
18
-
19
- expect(await processor.process(event)).toBeUndefined();
20
- });
@@ -1,8 +0,0 @@
1
- import { Corva } from '@corva/node-sdk';
2
- import { Processor } from './lib/processor';
3
-
4
- export const handler = new Corva().scheduled<{ some: string }, void>(async (event, context) => {
5
- const processor = new Processor(context.api, context.logger);
6
-
7
- await processor.process(event);
8
- });
@@ -1,14 +0,0 @@
1
- import type { HandlerContext, ScheduledLambdaEvent } from '@corva/node-sdk';
2
-
3
- export class Processor {
4
- constructor(private apiClient: HandlerContext['api'], private logger: HandlerContext['logger']) {}
5
-
6
- async process(event: ScheduledLambdaEvent<{ some: string }>) {
7
- this.logger.debug({ event }, 'Event');
8
-
9
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
10
- const { asset_id: assetId, schedule_start: scheduleStart, interval } = event;
11
-
12
- this.logger.info(`Processing event. Asset: ${assetId}. Schedule start: ${scheduleStart}`);
13
- }
14
- }
@@ -1,43 +0,0 @@
1
- import { Processor } from '../lib/processor';
2
- import type { HandlerContext } from '@corva/node-sdk';
3
- import { NormalizedStreamLambdaEvent } from '@corva/node-sdk/lib/lambdas/interfaces';
4
-
5
- test('process event', async () => {
6
- const fakeLogger = console as unknown as HandlerContext['logger'];
7
- const fakeApiClient = {} as unknown as HandlerContext['api'];
8
-
9
- const processor = new Processor(fakeApiClient, fakeLogger);
10
-
11
- const event = {
12
- asset_id: 1234,
13
- app_stream_id: 2345,
14
- records: [
15
- {
16
- company_id: 1,
17
- asset_id: 1234,
18
- timestamp: 157829400,
19
- data: { hole_depth: 1000 },
20
- },
21
- {
22
- company_id: 1,
23
- asset_id: 1234,
24
- timestamp: 157829401,
25
- data: { hole_depth: 1001 },
26
- },
27
- {
28
- company_id: 1,
29
- asset_id: 1234,
30
- timestamp: 157829402,
31
- data: { hole_depth: 1001 },
32
- },
33
- {
34
- company_id: 1,
35
- asset_id: 1234,
36
- timestamp: 157829403,
37
- data: { hole_depth: 1001.5 },
38
- },
39
- ],
40
- } as unknown as NormalizedStreamLambdaEvent<unknown>;
41
-
42
- expect(await processor.process(event)).toBeUndefined();
43
- });
@@ -1,8 +0,0 @@
1
- import { Corva } from '@corva/node-sdk';
2
- import { Processor } from './lib/processor';
3
-
4
- export const handler = new Corva().stream(async (event, context) => {
5
- const processor = new Processor(context.api, context.logger);
6
-
7
- await processor.process(event);
8
- });
@@ -1,16 +0,0 @@
1
- import type { HandlerContext } from '@corva/node-sdk';
2
- import { NormalizedStreamLambdaEvent } from '@corva/node-sdk/lib/lambdas/interfaces';
3
-
4
- export class Processor {
5
- constructor(private apiClient: HandlerContext['api'], private logger: HandlerContext['logger']) {}
6
-
7
- async process(event: NormalizedStreamLambdaEvent<unknown>) {
8
- const { asset_id, records } = event;
9
-
10
- if (!records.length) {
11
- return;
12
- }
13
-
14
- this.logger.info(`Processing event. Asset: ${asset_id}. Received ${records.length} records.`);
15
- }
16
- }
@@ -1,27 +0,0 @@
1
- import { HandlerContext, Task, TaskState } from '@corva/node-sdk';
2
- import { Processor } from '../src/processor';
3
-
4
- test('process event', async () => {
5
- const fakeLogger = console as unknown as HandlerContext['logger'];
6
- const fakeApiClient = {} as unknown as HandlerContext['api'];
7
-
8
- const event: Task<{
9
- foo: string;
10
- }> = {
11
- id: 'id',
12
- state: TaskState.Running,
13
- fail_reason: null,
14
- asset_id: 123,
15
- company_id: 1234,
16
- properties: {
17
- foo: 'bar',
18
- },
19
- document_bucket: 'test',
20
- payload: null,
21
- app_id: 42,
22
- };
23
-
24
- const processor = new Processor(fakeApiClient, fakeLogger);
25
-
26
- expect(await processor.process(event)).toBeUndefined();
27
- });
@@ -1,8 +0,0 @@
1
- import { Corva } from '@corva/node-sdk';
2
- import { Processor } from './src/processor';
3
-
4
- exports.handler = new Corva().task((event, context) => {
5
- const processor = new Processor(context.api, context.logger);
6
-
7
- return processor.process(event);
8
- });
@@ -1,14 +0,0 @@
1
- import type { HandlerContext, Task } from '@corva/node-sdk';
2
-
3
- export class Processor {
4
- constructor(private apiClient: HandlerContext['api'], private logger: HandlerContext['logger']) {}
5
-
6
- async process(event: Task) {
7
- this.logger.debug({ event }, 'Event');
8
-
9
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
10
- const { asset_id: assetId, company_id: companyId } = event;
11
-
12
- this.logger.info(`Processing event. Asset: ${assetId}`);
13
- }
14
- }