@mongoui/skills 0.1.8 → 0.2.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.
@@ -1,136 +1,136 @@
1
- # Flink Auth And Credentials
2
-
3
- ## Required Headers
4
-
5
- Send these headers on every Flink open-platform request:
6
-
7
- - `X-OP-App-Key`
8
- - `X-OP-Timestamp`
9
- - `X-OP-Nonce`
10
- - `X-OP-Sign`
11
-
12
- Optional headers that can help tracing or idempotency:
13
-
14
- - `X-OP-Client-Request-Id`
15
- - `X-Trace-Id`
16
- - `X-Idempotency-Key`
17
-
18
- `X-OP-App-Key` is the issued `open_app_id`.
19
-
20
- ## Signature Algorithm
21
-
22
- Build the canonical string in this exact order, separated by newline characters:
23
-
24
- ```text
25
- METHOD
26
- PATH
27
- CANONICAL_QUERY
28
- BODY_SHA256
29
- TIMESTAMP
30
- NONCE
31
- APP_KEY
32
- ```
33
-
34
- Rules:
35
-
36
- - Uppercase `METHOD`.
37
- - Use the exact public request path, for example `/openapi/v1/flink/zh_CN/flight/search`.
38
- - Sort query parameters by key and then value before joining them as `k=v&k2=v2`.
39
- - Hash the raw request body bytes with SHA256 and use the lowercase hex digest.
40
- - Use the request timestamp exactly as sent in `X-OP-Timestamp`.
41
- - Use the request nonce exactly as sent in `X-OP-Nonce`.
42
- - Use the same `open_app_id` that is sent in `X-OP-App-Key`.
43
- - Sign the canonical string with the plain `open_app_secret` using HMAC-SHA256, then output lowercase hex.
44
-
45
- Notes:
46
-
47
- - Timestamp may be Unix seconds, Unix milliseconds, or RFC3339.
48
- - The platform validates timestamp drift within roughly `+-5` minutes.
49
- - Nonce must be unique for the same app key in a short time window.
50
- - For empty bodies, hash the empty byte string.
51
-
52
- Use `scripts/flink_signed_request.py` when the task needs a deterministic implementation or a quick smoke test.
53
-
54
- ## Credential Acquisition
55
-
56
- Treat credentials as environment-specific.
57
-
58
- Sandbox:
59
-
60
- 1. The developer applies for app access.
61
- 2. The operator activates the app access with `env_type=sandbox`.
62
- 3. The platform records sandbox Flink mapping and issues a sandbox `open_app_id/open_app_secret`.
63
- 4. The app access becomes `sandbox_active`.
64
-
65
- Production:
66
-
67
- 1. The developer submits production access after sandbox work is complete.
68
- 2. The operator approves production with `env_type=production`.
69
- 3. The platform issues a production `open_app_id/open_app_secret`.
70
- 4. The production credential becomes usable only after the app access reaches `production_active`.
71
-
72
- Important constraints:
73
-
74
- - Sandbox and production credentials are separate and not interchangeable.
75
- - Developers can see platform credentials only.
76
- - Developers cannot see Flink downstream secrets.
77
-
78
- ## How To View Or Reset Keys
79
-
80
- Developer portal APIs:
81
-
82
- - `GET /api/portal/apps/{app_id}/credentials`
83
- - Returns the credential list for the app.
84
- - Includes `open_app_id`, `provider_code`, `env_type`, `open_secret_version`, and masked secret data.
85
- - Does not return the plain secret in normal list queries.
86
- - `POST /api/portal/apps/{app_id}/credentials/reset`
87
- - Resets the platform secret and returns `plain_open_secret`.
88
- - If the app has more than one credential mapping, pass both `provider_code` and `env_type`.
89
-
90
- Response fields that matter:
91
-
92
- - `open_app_id`: the App Key to place into `X-OP-App-Key`
93
- - `open_secret_masked`: masked secret for display only
94
- - `open_secret_version`: useful for rotation tracking
95
- - `plain_open_secret`: returned only on first issuance or reset
96
-
97
- Practical guidance:
98
-
99
- - If a developer says "I can only see a masked secret", instruct them to use the reset endpoint or the corresponding portal UI action.
100
- - If the task is only to call sandbox APIs, do not assume production credentials work.
101
- - If the app has both sandbox and production mappings, always name the target `env_type` explicitly.
102
-
103
- ## Common Auth Failures
104
-
105
- - `APP_KEY_INVALID`
106
- - Wrong `open_app_id`, wrong environment, or the credential does not exist.
107
- - `SIGN_ERROR`
108
- - Wrong secret, wrong path, wrong query ordering, wrong body hash, or newline formatting mismatch.
109
- - `TIMESTAMP_EXPIRED`
110
- - Clock skew exceeds the allowed window.
111
- - `NONCE_REPLAY`
112
- - Nonce was reused under the same app key.
113
- - `PRODUCT_FORBIDDEN`
114
- - The app is not enabled for the product, the mapping is not active, or an IP whitelist rule failed.
115
-
116
- ## Response Contract
117
-
118
- The platform wraps business responses in a common envelope:
119
-
120
- ```json
121
- {
122
- "request_id": "req_xxx",
123
- "trace_id": "trc_xxx",
124
- "downstream_request_id": "optional",
125
- "code": "SUCCESS",
126
- "message": "ok",
127
- "data": {}
128
- }
129
- ```
130
-
131
- Interpretation:
132
-
133
- - `request_id` and `trace_id` are platform-side tracing keys.
134
- - `downstream_request_id` is the Flink request identifier when available.
135
- - `code=SUCCESS` means the business call succeeded.
136
- - `code=SUPPLIER_BIZ_ERROR` means Flink returned a business error and can still arrive with HTTP `200`.
1
+ # Flink Auth And Credentials
2
+
3
+ ## Required Headers
4
+
5
+ Send these headers on every Flink open-platform request:
6
+
7
+ - `X-OP-App-Key`
8
+ - `X-OP-Timestamp`
9
+ - `X-OP-Nonce`
10
+ - `X-OP-Sign`
11
+
12
+ Optional headers that can help tracing or idempotency:
13
+
14
+ - `X-OP-Client-Request-Id`
15
+ - `X-Trace-Id`
16
+ - `X-Idempotency-Key`
17
+
18
+ `X-OP-App-Key` is the issued `open_app_id`.
19
+
20
+ ## Signature Algorithm
21
+
22
+ Build the canonical string in this exact order, separated by newline characters:
23
+
24
+ ```text
25
+ METHOD
26
+ PATH
27
+ CANONICAL_QUERY
28
+ BODY_SHA256
29
+ TIMESTAMP
30
+ NONCE
31
+ APP_KEY
32
+ ```
33
+
34
+ Rules:
35
+
36
+ - Uppercase `METHOD`.
37
+ - Use the exact public request path, for example `/openapi/v1/flink/zh_CN/flight/search`.
38
+ - Sort query parameters by key and then value before joining them as `k=v&k2=v2`.
39
+ - Hash the raw request body bytes with SHA256 and use the lowercase hex digest.
40
+ - Use the request timestamp exactly as sent in `X-OP-Timestamp`.
41
+ - Use the request nonce exactly as sent in `X-OP-Nonce`.
42
+ - Use the same `open_app_id` that is sent in `X-OP-App-Key`.
43
+ - Sign the canonical string with the plain `open_app_secret` using HMAC-SHA256, then output lowercase hex.
44
+
45
+ Notes:
46
+
47
+ - Timestamp may be Unix seconds, Unix milliseconds, or RFC3339.
48
+ - The platform validates timestamp drift within roughly `+-5` minutes.
49
+ - Nonce must be unique for the same app key in a short time window.
50
+ - For empty bodies, hash the empty byte string.
51
+
52
+ Use `scripts/flink_signed_request.py` when the task needs a deterministic implementation or a quick smoke test.
53
+
54
+ ## Credential Acquisition
55
+
56
+ Treat credentials as environment-specific.
57
+
58
+ Sandbox:
59
+
60
+ 1. The developer applies for app access.
61
+ 2. The operator activates the app access with `env_type=sandbox`.
62
+ 3. The platform records sandbox Flink mapping and issues a sandbox `open_app_id/open_app_secret`.
63
+ 4. The app access becomes `sandbox_active`.
64
+
65
+ Production:
66
+
67
+ 1. The developer submits production access after sandbox work is complete.
68
+ 2. The operator approves production with `env_type=production`.
69
+ 3. The platform issues a production `open_app_id/open_app_secret`.
70
+ 4. The production credential becomes usable only after the app access reaches `production_active`.
71
+
72
+ Important constraints:
73
+
74
+ - Sandbox and production credentials are separate and not interchangeable.
75
+ - Developers can see platform credentials only.
76
+ - Developers cannot see Flink downstream secrets.
77
+
78
+ ## How To View Or Reset Keys
79
+
80
+ Developer portal APIs:
81
+
82
+ - `GET /api/portal/apps/{app_id}/credentials`
83
+ - Returns the credential list for the app.
84
+ - Includes `open_app_id`, `provider_code`, `env_type`, `open_secret_version`, and masked secret data.
85
+ - Does not return the plain secret in normal list queries.
86
+ - `POST /api/portal/apps/{app_id}/credentials/reset`
87
+ - Resets the platform secret and returns `plain_open_secret`.
88
+ - If the app has more than one credential mapping, pass both `provider_code` and `env_type`.
89
+
90
+ Response fields that matter:
91
+
92
+ - `open_app_id`: the App Key to place into `X-OP-App-Key`
93
+ - `open_secret_masked`: masked secret for display only
94
+ - `open_secret_version`: useful for rotation tracking
95
+ - `plain_open_secret`: returned only on first issuance or reset
96
+
97
+ Practical guidance:
98
+
99
+ - If a developer says "I can only see a masked secret", instruct them to use the reset endpoint or the corresponding portal UI action.
100
+ - If the task is only to call sandbox APIs, do not assume production credentials work.
101
+ - If the app has both sandbox and production mappings, always name the target `env_type` explicitly.
102
+
103
+ ## Common Auth Failures
104
+
105
+ - `APP_KEY_INVALID`
106
+ - Wrong `open_app_id`, wrong environment, or the credential does not exist.
107
+ - `SIGN_ERROR`
108
+ - Wrong secret, wrong path, wrong query ordering, wrong body hash, or newline formatting mismatch.
109
+ - `TIMESTAMP_EXPIRED`
110
+ - Clock skew exceeds the allowed window.
111
+ - `NONCE_REPLAY`
112
+ - Nonce was reused under the same app key.
113
+ - `PRODUCT_FORBIDDEN`
114
+ - The app is not enabled for the product, the mapping is not active, or an IP whitelist rule failed.
115
+
116
+ ## Response Contract
117
+
118
+ The platform wraps business responses in a common envelope:
119
+
120
+ ```json
121
+ {
122
+ "request_id": "req_xxx",
123
+ "trace_id": "trc_xxx",
124
+ "downstream_request_id": "optional",
125
+ "code": "SUCCESS",
126
+ "message": "ok",
127
+ "data": {}
128
+ }
129
+ ```
130
+
131
+ Interpretation:
132
+
133
+ - `request_id` and `trace_id` are platform-side tracing keys.
134
+ - `downstream_request_id` is the Flink request identifier when available.
135
+ - `code=SUCCESS` means the business call succeeded.
136
+ - `code=SUPPLIER_BIZ_ERROR` means Flink returned a business error and can still arrive with HTTP `200`.
@@ -1,92 +1,92 @@
1
- # Flink Endpoint Index
2
-
3
- All routes are public gateway routes. Sign the public path, not the downstream Flink path.
4
-
5
- ## Flight Search
6
-
7
- - `flink.flight.search`
8
- - `POST /openapi/v1/flink/{lang}/flight/search`
9
- - Required body fields: `cabinClass`, `tripType`, `journeys`, `adultNum`
10
- - Common optional fields: `childNum`, `infantNum`, `airline`, `transferNumber`, `journeyId`, `corporate`
11
- - Main output to preserve: `priceKey`
12
- - `flink.flight.cabin`
13
- - `POST /openapi/v1/flink/{lang}/flight/cabin`
14
- - Required body fields: `priceKey`
15
- - Use to expand or refine fare options for a selected result
16
- - `flink.flight.verify`
17
- - `POST /openapi/v1/flink/{lang}/flight/verify`
18
- - Required body fields: `priceKey`
19
- - Use before order creation
20
-
21
- ## Order Management
22
-
23
- - `flink.flight.order.create`
24
- - `POST /openapi/v1/flink/{lang}/flight/order/create`
25
- - Required body fields: `priceKey`, `contactName`, `contactRegion`, `contactPhone`, `contactEmail`, `passenger`
26
- - Use after verify or directly after search or cabin when allowed by the business flow
27
- - `flink.flight.order.pay`
28
- - `POST /openapi/v1/flink/{lang}/flight/order/pay`
29
- - Required body fields: `orderNo`, `amount`, `type`
30
- - `type=0` for standard order, `type=1` for change order
31
- - `flink.flight.order.detail`
32
- - `POST /openapi/v1/flink/{lang}/flight/order/detail`
33
- - Required body fields: `orderNo`
34
- - `flink.flight.order.cancel`
35
- - `POST /openapi/v1/flink/{lang}/flight/order/cancel`
36
- - Required body fields: `orderNo`
37
-
38
- ## Change
39
-
40
- - `flink.flight.change.search`
41
- - `POST /openapi/v1/flink/{lang}/flight/change/search`
42
- - Required body fields: `orderNo`, `cabinClass`, `date`, `passenger`, `segmentId`
43
- - `flink.flight.change.apply`
44
- - `POST /openapi/v1/flink/{lang}/flight/change/apply`
45
- - Required body fields: `orderNo`, `passenger`, `segmentId`, `priceKey`, `changeOrderType`, `changeType`, `contactName`, `contactPhone`, `contactEmail`, `changeReasonType`, `changeReason`
46
- - `fileList` is required by schema when attachments are involved in involuntary changes
47
- - `flink.flight.change.cancel`
48
- - `POST /openapi/v1/flink/{lang}/flight/change/cancel`
49
- - Required body fields: `changeOrderNo`
50
- - `flink.flight.change.detail`
51
- - `POST /openapi/v1/flink/{lang}/flight/change/detail`
52
- - Required body fields: `changeOrderNo`
53
-
54
- ## Refund
55
-
56
- - `flink.flight.refund.apply`
57
- - `POST /openapi/v1/flink/{lang}/flight/refund/apply`
58
- - Required body fields: `orderNo`, `orderType`, `passenger`, `segmentId`, `refundType`, `reasonType`, `reason`, `fileList`, `contactName`, `contactRegion`, `contactPhone`, `contactEmail`
59
- - `flink.flight.refund.detail`
60
- - `POST /openapi/v1/flink/{lang}/flight/refund/detail`
61
- - Required body fields: `refundOrderNo`
62
- - `flink.flight.refund.confirm`
63
- - `POST /openapi/v1/flink/{lang}/flight/refund/confirm`
64
- - Required body fields: `refundOrderNo`, `confirm`
65
-
66
- ## Basic Data
67
-
68
- - `flink.airports.list`
69
- - `POST /openapi/v1/flink/{lang}/airports/list`
70
- - Required body fields: `page`, `pageSize`
71
- - Common optional fields: `keyword`
72
- - `flink.airlines.list`
73
- - `POST /openapi/v1/flink/{lang}/airlines/list`
74
- - Required body fields: `page`, `pageSize`
75
- - Common optional fields: `keyword`, `code`
76
- - `flink.airports.search`
77
- - `POST /openapi/v1/flink/{lang}/airports/search`
78
- - Common body field: `keyword`
79
- - `flink.nationality.list`
80
- - `POST /openapi/v1/flink/{lang}/nationality/list`
81
- - No required body fields in the current schema
82
- - `flink.fields`
83
- - `GET /openapi/v1/flink/fields`
84
- - Query parameters: `priceKey` optional, `orderNo` optional
85
- - Send at least one of `priceKey` or `orderNo`
86
-
87
- ## Global Notes
88
-
89
- - `{lang}` is required on every route except `flink.fields`.
90
- - Platform error responses can return `401`, `403`, `404`, `500`, `502`, or `504`.
91
- - Common auth-related `401` codes are `APP_KEY_INVALID`, `SIGN_ERROR`, `TIMESTAMP_EXPIRED`, and `NONCE_REPLAY`.
92
- - Common `403` cause is `PRODUCT_FORBIDDEN`.
1
+ # Flink Endpoint Index
2
+
3
+ All routes are public gateway routes. Sign the public path, not the downstream Flink path.
4
+
5
+ ## Flight Search
6
+
7
+ - `flink.flight.search`
8
+ - `POST /openapi/v1/flink/{lang}/flight/search`
9
+ - Required body fields: `cabinClass`, `tripType`, `journeys`, `adultNum`
10
+ - Common optional fields: `childNum`, `infantNum`, `airline`, `transferNumber`, `journeyId`, `corporate`
11
+ - Main output to preserve: `priceKey`
12
+ - `flink.flight.cabin`
13
+ - `POST /openapi/v1/flink/{lang}/flight/cabin`
14
+ - Required body fields: `priceKey`
15
+ - Use to expand or refine fare options for a selected result
16
+ - `flink.flight.verify`
17
+ - `POST /openapi/v1/flink/{lang}/flight/verify`
18
+ - Required body fields: `priceKey`
19
+ - Use before order creation
20
+
21
+ ## Order Management
22
+
23
+ - `flink.flight.order.create`
24
+ - `POST /openapi/v1/flink/{lang}/flight/order/create`
25
+ - Required body fields: `priceKey`, `contactName`, `contactRegion`, `contactPhone`, `contactEmail`, `passenger`
26
+ - Use after verify or directly after search or cabin when allowed by the business flow
27
+ - `flink.flight.order.pay`
28
+ - `POST /openapi/v1/flink/{lang}/flight/order/pay`
29
+ - Required body fields: `orderNo`, `amount`, `type`
30
+ - `type=0` for standard order, `type=1` for change order
31
+ - `flink.flight.order.detail`
32
+ - `POST /openapi/v1/flink/{lang}/flight/order/detail`
33
+ - Required body fields: `orderNo`
34
+ - `flink.flight.order.cancel`
35
+ - `POST /openapi/v1/flink/{lang}/flight/order/cancel`
36
+ - Required body fields: `orderNo`
37
+
38
+ ## Change
39
+
40
+ - `flink.flight.change.search`
41
+ - `POST /openapi/v1/flink/{lang}/flight/change/search`
42
+ - Required body fields: `orderNo`, `cabinClass`, `date`, `passenger`, `segmentId`
43
+ - `flink.flight.change.apply`
44
+ - `POST /openapi/v1/flink/{lang}/flight/change/apply`
45
+ - Required body fields: `orderNo`, `passenger`, `segmentId`, `priceKey`, `changeOrderType`, `changeType`, `contactName`, `contactPhone`, `contactEmail`, `changeReasonType`, `changeReason`
46
+ - `fileList` is required by schema when attachments are involved in involuntary changes
47
+ - `flink.flight.change.cancel`
48
+ - `POST /openapi/v1/flink/{lang}/flight/change/cancel`
49
+ - Required body fields: `changeOrderNo`
50
+ - `flink.flight.change.detail`
51
+ - `POST /openapi/v1/flink/{lang}/flight/change/detail`
52
+ - Required body fields: `changeOrderNo`
53
+
54
+ ## Refund
55
+
56
+ - `flink.flight.refund.apply`
57
+ - `POST /openapi/v1/flink/{lang}/flight/refund/apply`
58
+ - Required body fields: `orderNo`, `orderType`, `passenger`, `segmentId`, `refundType`, `reasonType`, `reason`, `fileList`, `contactName`, `contactRegion`, `contactPhone`, `contactEmail`
59
+ - `flink.flight.refund.detail`
60
+ - `POST /openapi/v1/flink/{lang}/flight/refund/detail`
61
+ - Required body fields: `refundOrderNo`
62
+ - `flink.flight.refund.confirm`
63
+ - `POST /openapi/v1/flink/{lang}/flight/refund/confirm`
64
+ - Required body fields: `refundOrderNo`, `confirm`
65
+
66
+ ## Basic Data
67
+
68
+ - `flink.airports.list`
69
+ - `POST /openapi/v1/flink/{lang}/airports/list`
70
+ - Required body fields: `page`, `pageSize`
71
+ - Common optional fields: `keyword`
72
+ - `flink.airlines.list`
73
+ - `POST /openapi/v1/flink/{lang}/airlines/list`
74
+ - Required body fields: `page`, `pageSize`
75
+ - Common optional fields: `keyword`, `code`
76
+ - `flink.airports.search`
77
+ - `POST /openapi/v1/flink/{lang}/airports/search`
78
+ - Common body field: `keyword`
79
+ - `flink.nationality.list`
80
+ - `POST /openapi/v1/flink/{lang}/nationality/list`
81
+ - No required body fields in the current schema
82
+ - `flink.fields`
83
+ - `GET /openapi/v1/flink/fields`
84
+ - Query parameters: `priceKey` optional, `orderNo` optional
85
+ - Send at least one of `priceKey` or `orderNo`
86
+
87
+ ## Global Notes
88
+
89
+ - `{lang}` is required on every route except `flink.fields`.
90
+ - Platform error responses can return `401`, `403`, `404`, `500`, `502`, or `504`.
91
+ - Common auth-related `401` codes are `APP_KEY_INVALID`, `SIGN_ERROR`, `TIMESTAMP_EXPIRED`, and `NONCE_REPLAY`.
92
+ - Common `403` cause is `PRODUCT_FORBIDDEN`.