@epilot/sdk 2.1.10 → 2.2.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 (95) hide show
  1. package/dist/bin/cli.js +66 -12
  2. package/dist/{js-yaml-DLCVPJ7G.js → js-yaml-UPZKYVRY.js} +15 -17
  3. package/package.json +1 -1
  4. package/definitions/access-token-runtime.json +0 -1
  5. package/definitions/access-token.json +0 -663
  6. package/definitions/address-runtime.json +0 -1
  7. package/definitions/address-suggestions-runtime.json +0 -1
  8. package/definitions/address-suggestions.json +0 -582
  9. package/definitions/address.json +0 -578
  10. package/definitions/ai-agents-runtime.json +0 -1
  11. package/definitions/ai-agents.json +0 -1711
  12. package/definitions/app-runtime.json +0 -1
  13. package/definitions/app.json +0 -4493
  14. package/definitions/audit-logs-runtime.json +0 -1
  15. package/definitions/audit-logs.json +0 -305
  16. package/definitions/automation-runtime.json +0 -1
  17. package/definitions/automation.json +0 -4815
  18. package/definitions/billing-runtime.json +0 -1
  19. package/definitions/billing.json +0 -837
  20. package/definitions/blueprint-manifest-runtime.json +0 -1
  21. package/definitions/blueprint-manifest.json +0 -3490
  22. package/definitions/consent-runtime.json +0 -1
  23. package/definitions/consent.json +0 -344
  24. package/definitions/customer-portal-runtime.json +0 -1
  25. package/definitions/customer-portal.json +0 -15676
  26. package/definitions/dashboard-runtime.json +0 -1
  27. package/definitions/dashboard.json +0 -484
  28. package/definitions/data-management-runtime.json +0 -1
  29. package/definitions/data-management.json +0 -972
  30. package/definitions/deduplication-runtime.json +0 -1
  31. package/definitions/deduplication.json +0 -183
  32. package/definitions/design-runtime.json +0 -1
  33. package/definitions/design.json +0 -1423
  34. package/definitions/document-runtime.json +0 -1
  35. package/definitions/document.json +0 -758
  36. package/definitions/email-settings-runtime.json +0 -1
  37. package/definitions/email-settings.json +0 -2748
  38. package/definitions/email-template-runtime.json +0 -1
  39. package/definitions/email-template.json +0 -1441
  40. package/definitions/entity-mapping-runtime.json +0 -1
  41. package/definitions/entity-mapping.json +0 -1642
  42. package/definitions/entity-runtime.json +0 -1
  43. package/definitions/entity.json +0 -10276
  44. package/definitions/environments-runtime.json +0 -1
  45. package/definitions/environments.json +0 -363
  46. package/definitions/erp-integration-runtime.json +0 -1
  47. package/definitions/erp-integration.json +0 -6304
  48. package/definitions/event-catalog-runtime.json +0 -1
  49. package/definitions/event-catalog.json +0 -1051
  50. package/definitions/file-runtime.json +0 -1
  51. package/definitions/file.json +0 -2842
  52. package/definitions/iban-runtime.json +0 -1
  53. package/definitions/iban.json +0 -132
  54. package/definitions/journey-runtime.json +0 -1
  55. package/definitions/journey.json +0 -2603
  56. package/definitions/kanban-runtime.json +0 -1
  57. package/definitions/kanban.json +0 -1505
  58. package/definitions/message-runtime.json +0 -1
  59. package/definitions/message.json +0 -2660
  60. package/definitions/metering-runtime.json +0 -1
  61. package/definitions/metering.json +0 -2321
  62. package/definitions/notes-runtime.json +0 -1
  63. package/definitions/notes.json +0 -1531
  64. package/definitions/notification-runtime.json +0 -1
  65. package/definitions/notification.json +0 -1425
  66. package/definitions/organization-runtime.json +0 -1
  67. package/definitions/organization.json +0 -1192
  68. package/definitions/partner-directory-runtime.json +0 -1
  69. package/definitions/partner-directory.json +0 -2284
  70. package/definitions/permissions-runtime.json +0 -1
  71. package/definitions/permissions.json +0 -1515
  72. package/definitions/pricing-runtime.json +0 -1
  73. package/definitions/pricing-tier-runtime.json +0 -1
  74. package/definitions/pricing-tier.json +0 -105
  75. package/definitions/pricing.json +0 -9884
  76. package/definitions/purpose-runtime.json +0 -1
  77. package/definitions/purpose.json +0 -524
  78. package/definitions/sandbox-runtime.json +0 -1
  79. package/definitions/sandbox.json +0 -453
  80. package/definitions/submission-runtime.json +0 -1
  81. package/definitions/submission.json +0 -313
  82. package/definitions/targeting-runtime.json +0 -1
  83. package/definitions/targeting.json +0 -1474
  84. package/definitions/template-variables-runtime.json +0 -1
  85. package/definitions/template-variables.json +0 -1408
  86. package/definitions/user-runtime.json +0 -1
  87. package/definitions/user.json +0 -2408
  88. package/definitions/validation-rules-runtime.json +0 -1
  89. package/definitions/validation-rules.json +0 -1491
  90. package/definitions/webhooks-runtime.json +0 -1
  91. package/definitions/webhooks.json +0 -1634
  92. package/definitions/workflow-definition-runtime.json +0 -1
  93. package/definitions/workflow-definition.json +0 -3417
  94. package/definitions/workflow-runtime.json +0 -1
  95. package/definitions/workflow.json +0 -4146
package/dist/bin/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/bin/cli.ts
4
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
4
+ import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "fs";
5
5
  import { dirname, resolve } from "path";
6
6
  var OVERRIDES_PATH = ".epilot/sdk-overrides.json";
7
7
  var usage = () => {
@@ -22,7 +22,7 @@ Examples:
22
22
  };
23
23
  var isYamlFile = (filePath) => filePath.endsWith(".yaml") || filePath.endsWith(".yml");
24
24
  var parseYaml = async (content) => {
25
- const { load } = await import("../js-yaml-DLCVPJ7G.js");
25
+ const { load } = await import("../js-yaml-UPZKYVRY.js");
26
26
  return load(content);
27
27
  };
28
28
  var readOverrides = () => {
@@ -121,21 +121,44 @@ var findSdkRoot = () => {
121
121
  }
122
122
  return null;
123
123
  };
124
+ var patchRuntimeChunk = (distDir, kebabName, compactSpec) => {
125
+ if (!existsSync(distDir)) return;
126
+ const runtimeFnName = `require_${kebabName.replace(/-/g, "_")}_runtime`;
127
+ const files = readdirSync(distDir);
128
+ let patched = false;
129
+ for (const file of files) {
130
+ if (!file.endsWith(".js") && !file.endsWith(".cjs")) continue;
131
+ if (file.startsWith("apis/")) continue;
132
+ const filePath = resolve(distDir, file);
133
+ const content = readFileSync(filePath, "utf-8");
134
+ if (!content.includes(runtimeFnName)) continue;
135
+ const newContent = content.replace(
136
+ /module\.exports\s*=\s*\{.*\};/,
137
+ `module.exports = ${JSON.stringify(compactSpec)};`
138
+ );
139
+ if (newContent !== content) {
140
+ writeFileSync(filePath, newContent);
141
+ console.log(` -> patched ${file} (runtime chunk)`);
142
+ patched = true;
143
+ }
144
+ }
145
+ if (!patched) {
146
+ console.log(` (no runtime chunk found to patch for ${kebabName})`);
147
+ }
148
+ };
124
149
  var overrideCmd = async (args) => {
125
150
  if (args.length === 2) {
126
151
  const [apiName, specPath] = args;
127
152
  const overrides2 = readOverrides();
128
153
  overrides2[apiName] = specPath;
129
154
  writeOverrides(overrides2);
130
- console.log(`Added override: ${apiName} -> ${specPath}`);
131
- console.log(`Run 'npx epilot-sdk override' to apply, then 'npx epilot-sdk typegen' to regenerate types.`);
132
- return;
155
+ console.log(`Saved override: ${apiName} -> ${specPath}`);
133
156
  }
134
157
  const overrides = readOverrides();
135
158
  const entries = Object.entries(overrides);
136
159
  if (entries.length === 0) {
137
160
  console.log(`No overrides found in ${OVERRIDES_PATH}`);
138
- console.log(`Create one with: npx epilot-sdk override <api-name> <spec-path>`);
161
+ console.log(`Usage: npx epilot-sdk override <api-name> <spec-path>`);
139
162
  return;
140
163
  }
141
164
  const sdkRoot = findSdkRoot();
@@ -144,6 +167,10 @@ var overrideCmd = async (args) => {
144
167
  process.exit(1);
145
168
  }
146
169
  const defsDir = resolve(sdkRoot, "definitions");
170
+ const distDir = resolve(sdkRoot, "dist");
171
+ if (!existsSync(defsDir)) {
172
+ mkdirSync(defsDir, { recursive: true });
173
+ }
147
174
  console.log(`Applying ${entries.length} override(s)...`);
148
175
  for (const [apiName, specPath] of entries) {
149
176
  try {
@@ -159,12 +186,13 @@ var overrideCmd = async (args) => {
159
186
  const runtimeDest = resolve(defsDir, `${kebabName}-runtime.json`);
160
187
  writeFileSync(runtimeDest, JSON.stringify(compactSpec));
161
188
  console.log(` -> definitions/${kebabName}-runtime.json`);
189
+ patchRuntimeChunk(distDir, kebabName, compactSpec);
162
190
  } catch (err) {
163
191
  console.error(` Error: ${err.message}`);
164
192
  }
165
193
  }
166
- console.log(`
167
- Done. Run 'npx epilot-sdk typegen' to regenerate types.`);
194
+ console.log("");
195
+ await typegenCmd();
168
196
  };
169
197
  var typegenCmd = async () => {
170
198
  try {
@@ -191,11 +219,37 @@ var typegenCmd = async () => {
191
219
  }
192
220
  console.log(`Generating types for ${apiName}...`);
193
221
  try {
194
- const typesPath = resolve(distDir, `apis/${kebabName}.d.ts`);
195
- execSync(`npx openapi-client-axios-typegen ${specPath} --client > ${typesPath}`, { stdio: "pipe" });
222
+ const dtsPath = resolve(distDir, `apis/${kebabName}.d.ts`);
223
+ const dctsPath = resolve(distDir, `apis/${kebabName}.d.cts`);
224
+ const generatedTypes = execSync(`npx openapi-client-axios-typegen ${specPath} --client`, {
225
+ stdio: "pipe",
226
+ encoding: "utf-8"
227
+ });
228
+ const moduleExports = [
229
+ "",
230
+ `import type { ApiHandle } from '../types';`,
231
+ `export { authorize } from '../authorize';`,
232
+ `export type { TokenArg } from '../authorize';`,
233
+ `export type { OpenAPIClient } from 'openapi-client-axios';`,
234
+ "",
235
+ "/** Get the cached singleton client (lazy-initialized on first call) */",
236
+ "declare const getClient: () => Client;",
237
+ "/** Create a fresh client instance (not cached) */",
238
+ "declare const createClient: () => Client;",
239
+ "/**",
240
+ " * API handle \u2014 also exposes operations directly:",
241
+ ` * \`${apiName}.getEntity(...)\` calls forwarded to lazy singleton`,
242
+ " */",
243
+ `declare const ${apiName}: ApiHandle<Client>;`,
244
+ "",
245
+ `export { getClient, createClient, ${apiName} };`
246
+ ].join("\n");
247
+ const fullContent = `${generatedTypes.trimEnd()}
248
+ ${moduleExports}
249
+ `;
250
+ writeFileSync(dtsPath, fullContent);
196
251
  console.log(` -> dist/apis/${kebabName}.d.ts`);
197
- const ctypesPath = resolve(distDir, `apis/${kebabName}.d.cts`);
198
- execSync(`npx openapi-client-axios-typegen ${specPath} --client > ${ctypesPath}`, { stdio: "pipe" });
252
+ writeFileSync(dctsPath, fullContent);
199
253
  console.log(` -> dist/apis/${kebabName}.d.cts`);
200
254
  } catch (err) {
201
255
  console.error(` Error generating types for ${apiName}: ${err.message}`);
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // ../../node_modules/.pnpm/js-yaml@4.1.1/node_modules/js-yaml/dist/js-yaml.mjs
3
+ // ../../node_modules/js-yaml/dist/js-yaml.mjs
4
4
  function isNothing(subject) {
5
5
  return typeof subject === "undefined" || subject === null;
6
6
  }
@@ -864,18 +864,6 @@ function charFromCodepoint(c) {
864
864
  (c - 65536 & 1023) + 56320
865
865
  );
866
866
  }
867
- function setProperty(object, key, value) {
868
- if (key === "__proto__") {
869
- Object.defineProperty(object, key, {
870
- configurable: true,
871
- enumerable: true,
872
- writable: true,
873
- value
874
- });
875
- } else {
876
- object[key] = value;
877
- }
878
- }
879
867
  var simpleEscapeCheck = new Array(256);
880
868
  var simpleEscapeMap = new Array(256);
881
869
  for (i = 0; i < 256; i++) {
@@ -995,7 +983,7 @@ function mergeMappings(state, destination, source, overridableKeys) {
995
983
  for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
996
984
  key = sourceKeys[index];
997
985
  if (!_hasOwnProperty$1.call(destination, key)) {
998
- setProperty(destination, key, source[key]);
986
+ destination[key] = source[key];
999
987
  overridableKeys[key] = true;
1000
988
  }
1001
989
  }
@@ -1035,7 +1023,16 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
1035
1023
  state.position = startPos || state.position;
1036
1024
  throwError(state, "duplicated mapping key");
1037
1025
  }
1038
- setProperty(_result, keyNode, valueNode);
1026
+ if (keyNode === "__proto__") {
1027
+ Object.defineProperty(_result, keyNode, {
1028
+ configurable: true,
1029
+ enumerable: true,
1030
+ writable: true,
1031
+ value: valueNode
1032
+ });
1033
+ } else {
1034
+ _result[keyNode] = valueNode;
1035
+ }
1039
1036
  delete overridableKeys[keyNode];
1040
1037
  }
1041
1038
  return _result;
@@ -2623,6 +2620,7 @@ var jsYaml = {
2623
2620
  safeLoadAll,
2624
2621
  safeDump
2625
2622
  };
2623
+ var js_yaml_default = jsYaml;
2626
2624
  export {
2627
2625
  CORE_SCHEMA,
2628
2626
  DEFAULT_SCHEMA,
@@ -2631,7 +2629,7 @@ export {
2631
2629
  Schema,
2632
2630
  Type,
2633
2631
  YAMLException,
2634
- jsYaml as default,
2632
+ js_yaml_default as default,
2635
2633
  dump,
2636
2634
  load,
2637
2635
  loadAll,
@@ -2643,5 +2641,5 @@ export {
2643
2641
  /*! Bundled license information:
2644
2642
 
2645
2643
  js-yaml/dist/js-yaml.mjs:
2646
- (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
2644
+ (*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT *)
2647
2645
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/sdk",
3
- "version": "2.1.10",
3
+ "version": "2.2.1",
4
4
  "description": "JavaScript/TypeScript SDK for epilot APIs",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -1 +0,0 @@
1
- {"s":"https://access-token.sls.epilot.io","o":[["createAccessToken","post","/v1/access-tokens",null,1],["listAccessTokens","get","/v1/access-tokens",[["token_type","q"]]],["revokeAccessToken","delete","/v1/access-tokens/{id}",[["id","p",true]]],["getAccessTokenJwks","get","/v1/access-tokens/.well-known/jwks.json"],["getAccessTokenOIDC","get","/v1/access-tokens/.well-known/openid-configuration"],["getPublicTokenJwks","get","/v1/access-tokens/public/.well-known/jwks.json"],["getPublicTokenOIDC","get","/v1/access-tokens/public/.well-known/openid-configuration"]],"v":"3.0.3"}