@midwayjs/fc-starter 3.12.3 → 3.12.5

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/dist/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  /// <reference types="node" />
2
- import { AbstractBootstrapStarter, FC } from '@midwayjs/faas';
2
+ import { AbstractBootstrapStarter } from '@midwayjs/faas';
3
+ import { InitializeContext } from './interface';
3
4
  export * from './mock';
5
+ export * from './interface';
4
6
  export declare class BootstrapStarter extends AbstractBootstrapStarter {
5
7
  onStart(): {};
6
- onInit(context: FC.InitializeContext, exports: any): Promise<void>;
8
+ onInit(context: InitializeContext, exports: any): Promise<void>;
7
9
  onRequest(event: any, context: any, oldContext: any): Promise<any>;
8
10
  onClose(): Promise<void>;
9
11
  protected createDefaultMockContext(): {
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ const getRawBody = require("raw-body");
21
21
  const async_hooks_context_manager_1 = require("@midwayjs/async-hooks-context-manager");
22
22
  const mock_1 = require("./mock");
23
23
  __exportStar(require("./mock"), exports);
24
+ __exportStar(require("./interface"), exports);
24
25
  function isOutputError() {
25
26
  return (process.env.SERVERLESS_OUTPUT_ERROR_STACK === 'true' ||
26
27
  ['local', 'development'].includes(process.env.MIDWAY_SERVER_ENV) ||
@@ -0,0 +1,170 @@
1
+ /// <reference types="node" />
2
+ interface SingleOSSEvent {
3
+ eventName: string;
4
+ eventSource: string;
5
+ eventTime: string;
6
+ eventVersion: string;
7
+ oss: {
8
+ bucket: {
9
+ arn: string;
10
+ name: string;
11
+ ownerIdentity: string;
12
+ virtualBucket: string;
13
+ };
14
+ object: {
15
+ deltaSize: number;
16
+ eTag: string;
17
+ key: string;
18
+ size: number;
19
+ };
20
+ ossSchemaVersion: string;
21
+ ruleId: string;
22
+ };
23
+ region: string;
24
+ requestParameters: {
25
+ sourceIPAddress: string;
26
+ };
27
+ responseElements: {
28
+ requestId: string;
29
+ };
30
+ userIdentity: {
31
+ principalId: string;
32
+ };
33
+ }
34
+ interface SingleCDNEvent {
35
+ eventName: string;
36
+ eventSource: string;
37
+ region: string;
38
+ eventVersion: string;
39
+ eventTime: string;
40
+ userIdentity: {
41
+ aliUid: string;
42
+ };
43
+ resource: {
44
+ domain: string;
45
+ };
46
+ eventParameter: {
47
+ domain: string;
48
+ endTime: number;
49
+ fileSize: number;
50
+ filePath: string;
51
+ startTime: number;
52
+ };
53
+ traceId: string;
54
+ }
55
+ interface MNSStreamEvent {
56
+ body: string;
57
+ attrs: {
58
+ Extend: string;
59
+ };
60
+ }
61
+ interface MNSJSONEvent {
62
+ Context: string;
63
+ TopicOwner: string;
64
+ Message: string;
65
+ Subscriber: string;
66
+ PublishTime: number;
67
+ SubscriptionName: string;
68
+ MessageMD5: string;
69
+ TopicName: string;
70
+ MessageId: string;
71
+ }
72
+ interface TableStoreRecord {
73
+ Type: 'string';
74
+ Info: {
75
+ Timestamp: number;
76
+ };
77
+ PrimaryKey: [
78
+ {
79
+ ColumnName: string;
80
+ Value: any;
81
+ }
82
+ ];
83
+ Columns: [
84
+ {
85
+ Type: string;
86
+ ColumnName: string;
87
+ Value: any;
88
+ Timestamp: number;
89
+ }
90
+ ];
91
+ }
92
+ export interface OSSEvent {
93
+ events: SingleOSSEvent[];
94
+ }
95
+ export type MNSEvent = string | MNSStreamEvent | MNSJSONEvent;
96
+ export interface SLSEvent {
97
+ parameter: Record<string, unknown>;
98
+ source: {
99
+ endpoint: string;
100
+ projectName: string;
101
+ logstoreName: string;
102
+ shardId: number;
103
+ beginCursor: string;
104
+ endCursor: string;
105
+ };
106
+ jobName: string;
107
+ taskId: string;
108
+ cursorTime: number;
109
+ }
110
+ export interface CDNEvent {
111
+ events: SingleCDNEvent[];
112
+ }
113
+ export interface TimerEvent {
114
+ triggerTime: string;
115
+ triggerName: string;
116
+ payload: string;
117
+ }
118
+ export interface APIGatewayEvent {
119
+ path: string;
120
+ httpMethod: string;
121
+ headers: {
122
+ [key: string]: string;
123
+ };
124
+ queryParameters: {
125
+ [key: string]: string;
126
+ };
127
+ pathParameters: {
128
+ [key: string]: string;
129
+ };
130
+ body: string;
131
+ isBase64Encoded: 'true' | 'false';
132
+ }
133
+ export interface APIGatewayResponse {
134
+ isBase64Encoded: boolean;
135
+ statusCode: number;
136
+ headers: Record<string, unknown>;
137
+ body: string;
138
+ }
139
+ export interface TableStoreEvent {
140
+ Version: string;
141
+ Records: TableStoreRecord[];
142
+ }
143
+ export interface InitializeContext {
144
+ requestId: string;
145
+ credentials: {
146
+ accessKeyId: string;
147
+ accessKeySecret: string;
148
+ securityToken: string;
149
+ };
150
+ function: {
151
+ name: string;
152
+ handler: string;
153
+ memory: number;
154
+ timeout: number;
155
+ initializer: string;
156
+ initializationTimeout: number;
157
+ };
158
+ service: {
159
+ name: string;
160
+ logProject: string;
161
+ logStore: string;
162
+ qualifier: string;
163
+ versionId: string;
164
+ };
165
+ region: string;
166
+ accountId: string;
167
+ logger: Console;
168
+ }
169
+ export {};
170
+ //# sourceMappingURL=interface.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=interface.js.map
package/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { InitializeContext } from './dist/index';
2
+
3
+ export * from './dist/index';
4
+
5
+ declare module '@midwayjs/faas/dist/interface' {
6
+ interface Context {
7
+ readonly originContext: InitializeContext;
8
+ }
9
+ }
package/package.json CHANGED
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "name": "@midwayjs/fc-starter",
3
- "version": "3.12.3",
4
- "main": "dist/index",
5
- "typings": "dist/index.d.ts",
3
+ "version": "3.12.5",
4
+ "main": "dist/index.js",
5
+ "typings": "index.d.ts",
6
6
  "dependencies": {
7
7
  "@midwayjs/async-hooks-context-manager": "^3.12.3",
8
- "@midwayjs/faas": "^3.12.3",
8
+ "@midwayjs/faas": "^3.12.5",
9
9
  "raw-body": "2.5.2"
10
10
  },
11
11
  "devDependencies": {
12
- "@midwayjs/core": "^3.12.3",
13
- "@midwayjs/serverless-http-parser": "^3.10.14"
12
+ "@midwayjs/core": "^3.12.3"
14
13
  },
15
14
  "engines": {
16
15
  "node": ">=12"
17
16
  },
18
17
  "files": [
19
18
  "dist/**/*.js",
20
- "dist/**/*.d.ts"
19
+ "dist/**/*.d.ts",
20
+ "index.d.ts"
21
21
  ],
22
22
  "scripts": {
23
23
  "build": "tsc",
@@ -29,5 +29,5 @@
29
29
  "url": "git@github.com:midwayjs/midway.git"
30
30
  },
31
31
  "license": "MIT",
32
- "gitHead": "0b6638726c4722d5a6ee8075fea0a0b68378452c"
32
+ "gitHead": "24c6b9f7a3be1bf37b3182286f3e55fc418a2c99"
33
33
  }