@antom-tech/node 0.1.2-beta.0 → 0.1.2-beta.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.
- package/README.md +1 -1
- package/dist/cjs/client.js +2 -1
- package/dist/cjs/sdk-user-agent.js +1 -0
- package/dist/cjs/special.d.ts +1 -1
- package/dist/cjs/special.js +3 -3
- package/dist/cjs/types.d.ts +0 -2
- package/dist/cjs/types.js +0 -3
- package/dist/esm/client.js +2 -1
- package/dist/esm/sdk-user-agent.js +1 -0
- package/dist/esm/special.js +1 -1
- package/dist/esm/types.js +0 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @antom-tech/node
|
|
2
2
|
|
|
3
|
-
Antom's server-side
|
|
3
|
+
Antom's server-side SDK requires Node.js newer than 22.23.5. It provides Promise-based business resources, TypeScript declarations, native ESM, CommonJS compatibility, and zero runtime dependencies.
|
|
4
4
|
|
|
5
5
|
This repository contains the runtime, generated API contracts, templates, tests, and packaged amount rules. Build a local tarball with `npm pack`, or publish the verified package to npm with `npm run release`.
|
|
6
6
|
|
package/dist/cjs/client.js
CHANGED
|
@@ -6,6 +6,7 @@ exports.DefaultAntomClient = exports.AntomClient = void 0;
|
|
|
6
6
|
const errors_js_1 = require("./errors.js");
|
|
7
7
|
const index_js_1 = require("./generated/resource/index.js");
|
|
8
8
|
const resources_js_1 = require("./resources.js");
|
|
9
|
+
const sdk_user_agent_js_1 = require("./sdk-user-agent.js");
|
|
9
10
|
const signature_js_1 = require("./signature.js");
|
|
10
11
|
const types_js_1 = require("./types.js");
|
|
11
12
|
const RESERVED_HEADERS = new Set([
|
|
@@ -93,7 +94,7 @@ class AntomClient {
|
|
|
93
94
|
headers.set('content-type', 'application/json; charset=UTF-8');
|
|
94
95
|
headers.set('client-id', this.#options.clientId);
|
|
95
96
|
headers.set('request-time', time);
|
|
96
|
-
headers.set('user-agent',
|
|
97
|
+
headers.set('user-agent', sdk_user_agent_js_1.SDK_USER_AGENT);
|
|
97
98
|
headers.set('signature', (0, signature_js_1.signRequest)({ method: 'POST', path, clientId: this.#options.clientId, time, body: rawBody }, this.#options.merchantPrivateKey, this.#options.keyVersion));
|
|
98
99
|
if (this.#options.agentToken)
|
|
99
100
|
headers.set('agent-token', this.#options.agentToken);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports.SDK_USER_AGENT = "antomsdk-nodejs/0.1.2-beta.1";
|
package/dist/cjs/special.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ClientHttp2Session } from 'node:http2';
|
|
2
|
-
import {
|
|
2
|
+
import type { AntomClientOptions } from './types.js';
|
|
3
3
|
/** Result envelope retained unchanged for callers to handle business outcomes. */
|
|
4
4
|
export interface SpecialApiResponse {
|
|
5
5
|
result: {
|
package/dist/cjs/special.js
CHANGED
|
@@ -6,8 +6,8 @@ exports.uploadProductImage = uploadProductImage;
|
|
|
6
6
|
const node_crypto_1 = require("node:crypto");
|
|
7
7
|
const node_http2_1 = require("node:http2");
|
|
8
8
|
const errors_js_1 = require("./errors.js");
|
|
9
|
+
const sdk_user_agent_js_1 = require("./sdk-user-agent.js");
|
|
9
10
|
const signature_js_1 = require("./signature.js");
|
|
10
|
-
const types_js_1 = require("./types.js");
|
|
11
11
|
const METER_PATH = '/ams/api/v1/meter/uploadEvent';
|
|
12
12
|
const IMAGE_PATH = '/ams/api/v1/billing/product/uploadImage';
|
|
13
13
|
const MAX_IMAGE_BYTES = 2 * 1024 * 1024;
|
|
@@ -133,7 +133,7 @@ async function uploadMeterEvents(options, body) {
|
|
|
133
133
|
':method': 'POST', ':path': METER_PATH,
|
|
134
134
|
'x-session-id': options.sessionId,
|
|
135
135
|
'content-type': 'application/json; charset=UTF-8',
|
|
136
|
-
accept: 'application/json', 'user-agent':
|
|
136
|
+
accept: 'application/json', 'user-agent': sdk_user_agent_js_1.SDK_USER_AGENT,
|
|
137
137
|
});
|
|
138
138
|
stream.on('response', headers => { status = Number(headers[':status']); });
|
|
139
139
|
stream.on('data', (chunk) => {
|
|
@@ -230,7 +230,7 @@ async function uploadProductImage(options, request) {
|
|
|
230
230
|
const headers = new Headers({
|
|
231
231
|
'Content-Type': payload.contentType,
|
|
232
232
|
Accept: 'application/json',
|
|
233
|
-
'User-Agent':
|
|
233
|
+
'User-Agent': sdk_user_agent_js_1.SDK_USER_AGENT,
|
|
234
234
|
'Client-Id': options.clientId,
|
|
235
235
|
'Request-Time': time,
|
|
236
236
|
Signature: (0, signature_js_1.signRequest)({ method: 'POST', path, clientId: options.clientId, time, body }, options.merchantPrivateKey, options.keyVersion),
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/** SDK identification shared by JSON and special transports. */
|
|
2
|
-
export declare const SDK_USER_AGENT = "antomsdk-nodejs/0.1.0";
|
|
3
1
|
declare const OPERATION_TYPES: unique symbol;
|
|
4
2
|
/** A generated POST operation carrying its request and response types. */
|
|
5
3
|
export interface Operation<TRequest, TResponse> {
|
package/dist/cjs/types.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SDK_USER_AGENT = void 0;
|
|
4
3
|
exports.assertRequestPath = assertRequestPath;
|
|
5
4
|
exports.defineOperation = defineOperation;
|
|
6
5
|
/** Client configuration and transport contracts shared by generated operations and the signed client. */
|
|
7
6
|
const errors_js_1 = require("./errors.js");
|
|
8
|
-
/** SDK identification shared by JSON and special transports. */
|
|
9
|
-
exports.SDK_USER_AGENT = 'antomsdk-nodejs/0.1.0';
|
|
10
7
|
/**
|
|
11
8
|
* Reject ambiguous or cross-origin paths before signing or sending credentials.
|
|
12
9
|
* @param path Absolute API path without an origin, query, or fragment.
|
package/dist/esm/client.js
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
import { AlipaySdkError } from './errors.js';
|
|
4
4
|
import { createResources } from './generated/resource/index.js';
|
|
5
5
|
import { createClientResources } from './resources.js';
|
|
6
|
+
import { SDK_USER_AGENT } from './sdk-user-agent.js';
|
|
6
7
|
import { signRequest, verifySignature } from './signature.js';
|
|
7
|
-
import {
|
|
8
|
+
import { assertRequestPath } from './types.js';
|
|
8
9
|
const RESERVED_HEADERS = new Set([
|
|
9
10
|
'signature', 'client-id', 'request-time', 'response-time', 'content-type', 'agent-token',
|
|
10
11
|
'user-agent', 'host', 'content-length', 'connection', 'transfer-encoding',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SDK_USER_AGENT = "antomsdk-nodejs/0.1.2-beta.1";
|
package/dist/esm/special.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { createHash, randomUUID } from 'node:crypto';
|
|
3
3
|
import { connect, constants } from 'node:http2';
|
|
4
4
|
import { AlipaySdkError } from './errors.js';
|
|
5
|
+
import { SDK_USER_AGENT } from './sdk-user-agent.js';
|
|
5
6
|
import { signRequest, verifySignature } from './signature.js';
|
|
6
|
-
import { SDK_USER_AGENT } from './types.js';
|
|
7
7
|
const METER_PATH = '/ams/api/v1/meter/uploadEvent';
|
|
8
8
|
const IMAGE_PATH = '/ams/api/v1/billing/product/uploadImage';
|
|
9
9
|
const MAX_IMAGE_BYTES = 2 * 1024 * 1024;
|
package/dist/esm/types.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/** Client configuration and transport contracts shared by generated operations and the signed client. */
|
|
2
2
|
import { AlipaySdkError } from './errors.js';
|
|
3
|
-
/** SDK identification shared by JSON and special transports. */
|
|
4
|
-
export const SDK_USER_AGENT = 'antomsdk-nodejs/0.1.0';
|
|
5
3
|
/**
|
|
6
4
|
* Reject ambiguous or cross-origin paths before signing or sending credentials.
|
|
7
5
|
* @param path Absolute API path without an origin, query, or fragment.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antom-tech/node",
|
|
3
|
-
"version": "0.1.2-beta.
|
|
3
|
+
"version": "0.1.2-beta.1",
|
|
4
4
|
"description": "Antom server-side SDK for Node.js with TypeScript definitions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
|
-
"node": "
|
|
37
|
+
"node": ">22.23.5"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "node scripts/build.mjs",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"snapshot:exports:update": "npm run build && node scripts/update-export-snapshots.mjs"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@types/node": "^22.
|
|
48
|
+
"@types/node": "^22.20.5",
|
|
49
49
|
"typescript": "^5.9.3"
|
|
50
50
|
}
|
|
51
51
|
}
|