@nurama/sdk 0.0.0-stage → 1.4.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/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +1080 -2
- package/dist/BotClient.d.ts +66 -0
- package/dist/BotClient.d.ts.map +1 -0
- package/dist/BotClient.js +68 -0
- package/dist/BotClient.js.map +1 -0
- package/dist/NuramaClient.d.ts +480 -0
- package/dist/NuramaClient.d.ts.map +1 -0
- package/dist/NuramaClient.js +902 -0
- package/dist/NuramaClient.js.map +1 -0
- package/dist/browser/nurama-bot-sdk.js +12051 -0
- package/dist/browser/nurama-bot-sdk.min.js +1 -0
- package/dist/browser/nurama-sdk.js +12003 -0
- package/dist/browser/nurama-sdk.min.js +1 -0
- package/dist/routes/ai.d.ts +280 -0
- package/dist/routes/ai.d.ts.map +1 -0
- package/dist/routes/ai.js +173 -0
- package/dist/routes/ai.js.map +1 -0
- package/dist/routes/asset.d.ts +493 -0
- package/dist/routes/asset.d.ts.map +1 -0
- package/dist/routes/asset.js +848 -0
- package/dist/routes/asset.js.map +1 -0
- package/dist/routes/auth.d.ts +218 -0
- package/dist/routes/auth.d.ts.map +1 -0
- package/dist/routes/auth.js +454 -0
- package/dist/routes/auth.js.map +1 -0
- package/dist/routes/blogPosts.d.ts +17 -0
- package/dist/routes/blogPosts.d.ts.map +1 -0
- package/dist/routes/blogPosts.js +29 -0
- package/dist/routes/blogPosts.js.map +1 -0
- package/dist/routes/board.d.ts +187 -0
- package/dist/routes/board.d.ts.map +1 -0
- package/dist/routes/board.js +270 -0
- package/dist/routes/board.js.map +1 -0
- package/dist/routes/bot.d.ts +202 -0
- package/dist/routes/bot.d.ts.map +1 -0
- package/dist/routes/bot.js +229 -0
- package/dist/routes/bot.js.map +1 -0
- package/dist/routes/chat.d.ts +842 -0
- package/dist/routes/chat.d.ts.map +1 -0
- package/dist/routes/chat.js +863 -0
- package/dist/routes/chat.js.map +1 -0
- package/dist/routes/chatAi.d.ts +51 -0
- package/dist/routes/chatAi.d.ts.map +1 -0
- package/dist/routes/chatAi.js +109 -0
- package/dist/routes/chatAi.js.map +1 -0
- package/dist/routes/config.d.ts +11 -0
- package/dist/routes/config.d.ts.map +1 -0
- package/dist/routes/config.js +24 -0
- package/dist/routes/config.js.map +1 -0
- package/dist/routes/convo.d.ts +169 -0
- package/dist/routes/convo.d.ts.map +1 -0
- package/dist/routes/convo.js +284 -0
- package/dist/routes/convo.js.map +1 -0
- package/dist/routes/credits.d.ts +82 -0
- package/dist/routes/credits.d.ts.map +1 -0
- package/dist/routes/credits.js +49 -0
- package/dist/routes/credits.js.map +1 -0
- package/dist/routes/device.d.ts +74 -0
- package/dist/routes/device.d.ts.map +1 -0
- package/dist/routes/device.js +122 -0
- package/dist/routes/device.js.map +1 -0
- package/dist/routes/folder.d.ts +75 -0
- package/dist/routes/folder.d.ts.map +1 -0
- package/dist/routes/folder.js +99 -0
- package/dist/routes/folder.js.map +1 -0
- package/dist/routes/invite.d.ts +61 -0
- package/dist/routes/invite.d.ts.map +1 -0
- package/dist/routes/invite.js +86 -0
- package/dist/routes/invite.js.map +1 -0
- package/dist/routes/joinLink.d.ts +88 -0
- package/dist/routes/joinLink.d.ts.map +1 -0
- package/dist/routes/joinLink.js +205 -0
- package/dist/routes/joinLink.js.map +1 -0
- package/dist/routes/membership.d.ts +116 -0
- package/dist/routes/membership.d.ts.map +1 -0
- package/dist/routes/membership.js +183 -0
- package/dist/routes/membership.js.map +1 -0
- package/dist/routes/notification.d.ts +103 -0
- package/dist/routes/notification.d.ts.map +1 -0
- package/dist/routes/notification.js +89 -0
- package/dist/routes/notification.js.map +1 -0
- package/dist/routes/oauthGrant.d.ts +45 -0
- package/dist/routes/oauthGrant.d.ts.map +1 -0
- package/dist/routes/oauthGrant.js +32 -0
- package/dist/routes/oauthGrant.js.map +1 -0
- package/dist/routes/payment.d.ts +56 -0
- package/dist/routes/payment.d.ts.map +1 -0
- package/dist/routes/payment.js +78 -0
- package/dist/routes/payment.js.map +1 -0
- package/dist/routes/product.d.ts +43 -0
- package/dist/routes/product.d.ts.map +1 -0
- package/dist/routes/product.js +53 -0
- package/dist/routes/product.js.map +1 -0
- package/dist/routes/project.d.ts +821 -0
- package/dist/routes/project.d.ts.map +1 -0
- package/dist/routes/project.js +1153 -0
- package/dist/routes/project.js.map +1 -0
- package/dist/routes/public.d.ts +269 -0
- package/dist/routes/public.d.ts.map +1 -0
- package/dist/routes/public.js +412 -0
- package/dist/routes/public.js.map +1 -0
- package/dist/routes/scratch.d.ts +70 -0
- package/dist/routes/scratch.d.ts.map +1 -0
- package/dist/routes/scratch.js +67 -0
- package/dist/routes/scratch.js.map +1 -0
- package/dist/routes/settings.d.ts +102 -0
- package/dist/routes/settings.d.ts.map +1 -0
- package/dist/routes/settings.js +94 -0
- package/dist/routes/settings.js.map +1 -0
- package/dist/routes/shortlink.d.ts +79 -0
- package/dist/routes/shortlink.d.ts.map +1 -0
- package/dist/routes/shortlink.js +25 -0
- package/dist/routes/shortlink.js.map +1 -0
- package/dist/routes/socket.d.ts +108 -0
- package/dist/routes/socket.d.ts.map +1 -0
- package/dist/routes/socket.js +573 -0
- package/dist/routes/socket.js.map +1 -0
- package/dist/routes/storage.d.ts +44 -0
- package/dist/routes/storage.d.ts.map +1 -0
- package/dist/routes/storage.js +49 -0
- package/dist/routes/storage.js.map +1 -0
- package/dist/routes/subscription.d.ts +184 -0
- package/dist/routes/subscription.d.ts.map +1 -0
- package/dist/routes/subscription.js +219 -0
- package/dist/routes/subscription.js.map +1 -0
- package/dist/routes/supportChat.d.ts +40 -0
- package/dist/routes/supportChat.d.ts.map +1 -0
- package/dist/routes/supportChat.js +53 -0
- package/dist/routes/supportChat.js.map +1 -0
- package/dist/routes/supportTicket.d.ts +89 -0
- package/dist/routes/supportTicket.d.ts.map +1 -0
- package/dist/routes/supportTicket.js +54 -0
- package/dist/routes/supportTicket.js.map +1 -0
- package/dist/routes/tag.d.ts +72 -0
- package/dist/routes/tag.d.ts.map +1 -0
- package/dist/routes/tag.js +81 -0
- package/dist/routes/tag.js.map +1 -0
- package/dist/routes/task.d.ts +252 -0
- package/dist/routes/task.d.ts.map +1 -0
- package/dist/routes/task.js +284 -0
- package/dist/routes/task.js.map +1 -0
- package/dist/routes/taskRelation.d.ts +80 -0
- package/dist/routes/taskRelation.d.ts.map +1 -0
- package/dist/routes/taskRelation.js +71 -0
- package/dist/routes/taskRelation.js.map +1 -0
- package/dist/routes/token.d.ts +97 -0
- package/dist/routes/token.d.ts.map +1 -0
- package/dist/routes/token.js +73 -0
- package/dist/routes/token.js.map +1 -0
- package/dist/routes/user.d.ts +112 -0
- package/dist/routes/user.d.ts.map +1 -0
- package/dist/routes/user.js +151 -0
- package/dist/routes/user.js.map +1 -0
- package/dist/routes/version.d.ts +42 -0
- package/dist/routes/version.d.ts.map +1 -0
- package/dist/routes/version.js +38 -0
- package/dist/routes/version.js.map +1 -0
- package/dist/routes/webhook.d.ts +170 -0
- package/dist/routes/webhook.d.ts.map +1 -0
- package/dist/routes/webhook.js +173 -0
- package/dist/routes/webhook.js.map +1 -0
- package/dist/routes/workspace.d.ts +120 -0
- package/dist/routes/workspace.d.ts.map +1 -0
- package/dist/routes/workspace.js +199 -0
- package/dist/routes/workspace.js.map +1 -0
- package/dist/utils/uploadSessionManager.d.ts +133 -0
- package/dist/utils/uploadSessionManager.d.ts.map +1 -0
- package/dist/utils/uploadSessionManager.js +321 -0
- package/dist/utils/uploadSessionManager.js.map +1 -0
- package/dist/utils/urlParams.d.ts +35 -0
- package/dist/utils/urlParams.d.ts.map +1 -0
- package/dist/utils/urlParams.js +146 -0
- package/dist/utils/urlParams.js.map +1 -0
- package/dist/version.d.ts +15 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +12 -0
- package/dist/version.js.map +1 -0
- package/package.json +87 -3
- package/src/BotClient.ts +113 -0
- package/src/NuramaClient.ts +1253 -0
- package/src/bot-browser-entry.js +15 -0
- package/src/browser-entry.js +20 -0
- package/src/routes/ai.ts +378 -0
- package/src/routes/asset.ts +1104 -0
- package/src/routes/auth.ts +587 -0
- package/src/routes/blogPosts.ts +29 -0
- package/src/routes/board.ts +403 -0
- package/src/routes/bot.ts +356 -0
- package/src/routes/chat.ts +1292 -0
- package/src/routes/chatAi.ts +125 -0
- package/src/routes/config.ts +31 -0
- package/src/routes/convo.ts +321 -0
- package/src/routes/credits.ts +112 -0
- package/src/routes/device.ts +133 -0
- package/src/routes/folder.ts +154 -0
- package/src/routes/invite.ts +133 -0
- package/src/routes/joinLink.ts +233 -0
- package/src/routes/membership.ts +237 -0
- package/src/routes/notification.ts +166 -0
- package/src/routes/oauthGrant.ts +64 -0
- package/src/routes/payment.ts +104 -0
- package/src/routes/product.ts +67 -0
- package/src/routes/project.ts +1528 -0
- package/src/routes/public.ts +496 -0
- package/src/routes/scratch.ts +94 -0
- package/src/routes/settings.ts +152 -0
- package/src/routes/shortlink.ts +90 -0
- package/src/routes/socket.ts +757 -0
- package/src/routes/storage.ts +83 -0
- package/src/routes/subscription.ts +307 -0
- package/src/routes/supportChat.ts +62 -0
- package/src/routes/supportTicket.ts +114 -0
- package/src/routes/tag.ts +131 -0
- package/src/routes/task.ts +431 -0
- package/src/routes/taskRelation.ts +125 -0
- package/src/routes/token.ts +152 -0
- package/src/routes/user.ts +214 -0
- package/src/routes/version.ts +62 -0
- package/src/routes/webhook.ts +295 -0
- package/src/routes/workspace.ts +223 -0
- package/src/utils/uploadSessionManager.ts +407 -0
- package/src/utils/urlParams.ts +181 -0
- package/src/version.ts +22 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for handling URL parameters
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Converts a parameter object to URL-safe query parameters.
|
|
7
|
+
* Arrays are serialized as comma-separated values, using bracket notation, or as repeated parameters.
|
|
8
|
+
* Objects are serialized as JSON strings.
|
|
9
|
+
*
|
|
10
|
+
* @param params - The parameter object to convert
|
|
11
|
+
* @param options - Options for serialization
|
|
12
|
+
* @returns An array of [key, value] pairs suitable for URLSearchParams
|
|
13
|
+
*/
|
|
14
|
+
export interface UrlParamsOptions {
|
|
15
|
+
/** How to handle arrays: 'comma' for comma-separated, 'brackets' for key[]=value&key[]=value2, 'repeat' for key=value1&key=value2 */
|
|
16
|
+
arrayFormat?: 'comma' | 'brackets' | 'repeat';
|
|
17
|
+
/** How to handle nested objects: 'json' to stringify, 'dot' for dot notation, 'bracket' for key[subkey]=value */
|
|
18
|
+
objectFormat?: 'json' | 'dot' | 'bracket';
|
|
19
|
+
/** Whether to encode values (default: true) */
|
|
20
|
+
encode?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function parseUrlParams(
|
|
24
|
+
params: Record<string, any>,
|
|
25
|
+
options: UrlParamsOptions = {}
|
|
26
|
+
): Array<[string, string]> {
|
|
27
|
+
const {
|
|
28
|
+
arrayFormat = 'repeat', // Changed default to repeat for backend compatibility
|
|
29
|
+
objectFormat = 'bracket', // Changed default to bracket for API compatibility
|
|
30
|
+
encode = true // Changed default to true as requested
|
|
31
|
+
} = options;
|
|
32
|
+
|
|
33
|
+
const result: Array<[string, string]> = [];
|
|
34
|
+
|
|
35
|
+
const encodeValue = (value: string): string => {
|
|
36
|
+
return encode ? encodeURIComponent(value) : value;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const processValue = (key: string, value: any): void => {
|
|
40
|
+
if (value === null || value === undefined) {
|
|
41
|
+
return; // Skip null/undefined values
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (Array.isArray(value)) {
|
|
45
|
+
if (arrayFormat === 'comma') {
|
|
46
|
+
// Convert array to comma-separated string
|
|
47
|
+
result.push([key, encodeValue(value.join(','))]);
|
|
48
|
+
} else if (arrayFormat === 'brackets') {
|
|
49
|
+
// Use bracket notation: key[]=value1&key[]=value2
|
|
50
|
+
const bracketKey = `${key}[]`;
|
|
51
|
+
value.forEach((item: any) => {
|
|
52
|
+
result.push([bracketKey, encodeValue(String(item))]);
|
|
53
|
+
});
|
|
54
|
+
} else if (arrayFormat === 'repeat') {
|
|
55
|
+
// Use repeated key: key=value1&key=value2
|
|
56
|
+
value.forEach((item: any) => {
|
|
57
|
+
result.push([key, encodeValue(String(item))]);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
} else if (value instanceof Date) {
|
|
61
|
+
// Handle Date objects specifically
|
|
62
|
+
result.push([key, encodeValue(value.toString())]);
|
|
63
|
+
} else if (typeof value === 'object') {
|
|
64
|
+
if (objectFormat === 'json') {
|
|
65
|
+
// Stringify objects as JSON
|
|
66
|
+
result.push([key, encodeValue(JSON.stringify(value))]);
|
|
67
|
+
} else if (objectFormat === 'dot') {
|
|
68
|
+
// Use dot notation for nested objects
|
|
69
|
+
flattenObject(value, key, result, encodeValue);
|
|
70
|
+
} else if (objectFormat === 'bracket') {
|
|
71
|
+
// Use bracket notation for nested objects
|
|
72
|
+
flattenObjectBracket(value, key, result, encodeValue);
|
|
73
|
+
}
|
|
74
|
+
} else if (typeof value === 'boolean') {
|
|
75
|
+
result.push([key, encodeValue(value.toString())]);
|
|
76
|
+
} else if (typeof value === 'number') {
|
|
77
|
+
result.push([key, encodeValue(value.toString())]);
|
|
78
|
+
} else if (typeof value === 'string') {
|
|
79
|
+
result.push([key, encodeValue(value)]);
|
|
80
|
+
} else {
|
|
81
|
+
// For any other type, convert to string
|
|
82
|
+
result.push([key, encodeValue(String(value))]);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// Process each parameter
|
|
87
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
88
|
+
processValue(key, value);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Flattens nested objects using dot notation
|
|
96
|
+
* @param obj - The object to flatten
|
|
97
|
+
* @param prefix - The current key prefix
|
|
98
|
+
* @param result - The result array to populate
|
|
99
|
+
* @param encodeValue - Function to encode values
|
|
100
|
+
*/
|
|
101
|
+
function flattenObject(
|
|
102
|
+
obj: Record<string, any>,
|
|
103
|
+
prefix: string,
|
|
104
|
+
result: Array<[string, string]>,
|
|
105
|
+
encodeValue: (value: string) => string
|
|
106
|
+
): void {
|
|
107
|
+
Object.entries(obj).forEach(([key, value]) => {
|
|
108
|
+
const newKey = `${prefix}.${key}`;
|
|
109
|
+
|
|
110
|
+
if (value === null || value === undefined) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (typeof value === 'object' && !Array.isArray(value)) {
|
|
115
|
+
flattenObject(value, newKey, result, encodeValue);
|
|
116
|
+
} else if (Array.isArray(value)) {
|
|
117
|
+
result.push([newKey, encodeValue(value.join(','))]);
|
|
118
|
+
} else {
|
|
119
|
+
result.push([newKey, encodeValue(String(value))]);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Flattens nested objects using bracket notation
|
|
126
|
+
* @param obj - The object to flatten
|
|
127
|
+
* @param prefix - The current key prefix
|
|
128
|
+
* @param result - The result array to populate
|
|
129
|
+
* @param encodeValue - Function to encode values
|
|
130
|
+
*/
|
|
131
|
+
function flattenObjectBracket(
|
|
132
|
+
obj: Record<string, any>,
|
|
133
|
+
prefix: string,
|
|
134
|
+
result: Array<[string, string]>,
|
|
135
|
+
encodeValue: (value: string) => string
|
|
136
|
+
): void {
|
|
137
|
+
Object.entries(obj).forEach(([key, value]) => {
|
|
138
|
+
const newKey = `${prefix}[${key}]`;
|
|
139
|
+
|
|
140
|
+
if (value === null || value === undefined) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (typeof value === 'object' && !Array.isArray(value)) {
|
|
145
|
+
flattenObjectBracket(value, newKey, result, encodeValue);
|
|
146
|
+
} else if (Array.isArray(value)) {
|
|
147
|
+
result.push([newKey, encodeValue(value.join(','))]);
|
|
148
|
+
} else {
|
|
149
|
+
result.push([newKey, encodeValue(String(value))]);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Converts parsed URL parameters back to a URLSearchParams object
|
|
156
|
+
* @param params - The parsed parameters as key-value pairs
|
|
157
|
+
* @returns URLSearchParams object
|
|
158
|
+
*/
|
|
159
|
+
export function createUrlSearchParams(params: Array<[string, string]>): URLSearchParams {
|
|
160
|
+
const searchParams = new URLSearchParams();
|
|
161
|
+
params.forEach(([key, value]) => {
|
|
162
|
+
searchParams.append(key, value);
|
|
163
|
+
});
|
|
164
|
+
return searchParams;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Convenience function that combines parseUrlParams and createUrlSearchParams
|
|
169
|
+
* @param params - The parameter object to convert
|
|
170
|
+
* @param options - Options for serialization
|
|
171
|
+
* @returns URLSearchParams object
|
|
172
|
+
*/
|
|
173
|
+
export function paramsToUrlSearchParams(
|
|
174
|
+
params: Record<string, any>,
|
|
175
|
+
options?: UrlParamsOptions
|
|
176
|
+
): URLSearchParams {
|
|
177
|
+
// Force encode: false because URLSearchParams.toString() handles encoding.
|
|
178
|
+
// Pre-encoding here would cause double-encoding (e.g. space → %20 → %2520).
|
|
179
|
+
const parsedParams = parseUrlParams(params, { ...options, encode: false });
|
|
180
|
+
return createUrlSearchParams(parsedParams);
|
|
181
|
+
}
|
package/src/version.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Version Information
|
|
3
|
+
* AUTO-GENERATED by scripts/generate-version-info.cjs - DO NOT EDIT MANUALLY
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface SDKVersionInfo {
|
|
7
|
+
/** The release number for a published build; `<package.json version>+<source hash>` for any other build. */
|
|
8
|
+
version: string;
|
|
9
|
+
buildTimestamp: string;
|
|
10
|
+
buildHash: string;
|
|
11
|
+
gitCommit: string;
|
|
12
|
+
/** The build included uncommitted SDK changes. */
|
|
13
|
+
dirty: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const SDK_VERSION: SDKVersionInfo = {
|
|
17
|
+
version: '1.4.1',
|
|
18
|
+
buildTimestamp: '2026-10-10T06:58:40.258Z',
|
|
19
|
+
buildHash: 'f6505e2eb9725dc8d239bb401ced8f88',
|
|
20
|
+
gitCommit: '1c00e18',
|
|
21
|
+
dirty: false,
|
|
22
|
+
};
|