Skip to content

BREAKING CHANGE(core): Remove Bluebird, replace with native promises - #980

Merged
kreddlear merged 20 commits into
zapier-platform-major-release-17.0.0-devfrom
pde-5261-replace-bluebird
Apr 21, 2025
Merged

kreddlear merged 20 commits into
zapier-platform-major-release-17.0.0-devfrom
pde-5261-replace-bluebird

Conversation

@kreddlear

@kreddlear kreddlear commented Mar 7, 2025 •

Copy link
Copy Markdown
Contributor

Summary

This PR removes the dependency on the Bluebird package and modernizes async handling across the codebase by switching to native Promises and async/await.

Changes

  • Removed usage of the Bluebird package in favor of native Promises - the Bluebird library is no longer actively maintained nor recommended, and its presence is causing issues for the Integrations teams, especially with Typescript
    • This also means that Promise is no longer globally patched with Bluebird Promises - instead Promise refers to a native Promise as would normally be expected.
  • Replaced Bluebird error contextifying with a whatHappened array of strings stored in the _zapier object, to ensure error context is still bubbled up as expected
  • Added enrichErrorMessages method to middleware to enable above error context
  • Updated Lambda handler to use async/await instead of callbacks
  • Refactored middleware functions to use async/await for improved readability and maintainability

Motivation

Simplifies the async flow, reduces external dependencies, and aligns the codebase with modern JavaScript practices.

Comment on lines -191 to -199
// Wait for all async events to complete before callback returns.
// This is not strictly necessary since this is the default now when
// using the callback; just putting it here to be explicit.
// In some cases, the code hangs and never exits because the event loop is not
// empty, so we can override the default behavior and exit after the app is done.
context.callbackWaitsForEmptyEventLoop = true;
if (event.skipWaitForAsync === true) {
context.callbackWaitsForEmptyEventLoop = false;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this since we're not using callbacks anymore, so it likely will not apply. Need to remove the corresponding z/z code and Gargoyle switch as well - context here, AWS docs here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's good to remove callbackWaitsForEmptyEventLoop. 👍

Side note: It's not entirely clear how AWS Lambda behaves when we have unawaited promises with async/await. I did some experimenting and found the following:

  • If an unawaited promise is rejected, Lambda might return an error—but not always. Sometimes the function completes successfully. When it does error and crash, Lambda appears to re-initialize the function on the next invocation.
  • If an unawaited promise resolves successfully, Lambda always returns successfully without waiting for the promise to finish.

With callbacks, the behavior is more predictable:

The function continues to execute until the event loop is empty or the function times out, unless context.callbackWaitsForEmptyEventLoop is set to false.

So it's as if context.callbackWaitsForEmptyEventLoop is now always false when we refactor code from callbacks to async/await. I assume that's fine because we don't rely on callbacks to finish anything in background. The only way to make sure this behavioral difference doesn't break existing integrations is canary testing, I think.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's as if context.callbackWaitsForEmptyEventLoop is now always false when we refactor code from callbacks to async/await. I assume that's fine because we don't rely on callbacks to finish anything in background. The only way to make sure this behavioral difference doesn't break existing integrations is canary testing, I think.

Yes, this is my impression as well. I think it will be fine, but it's hard to know exactly how integrations will behave.

Are there any particular integrations/integration types you'd recommend to canary to make sure that this doesn't break certain functionality? I'll be canary testing integrations relying on the legacy scripting runner, and if you have ideas for other integration functionality to focus on, I'd be happy to test those cases as well.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should canary test on a few popular integrations, starting with the ones that have few users, of course. But I agree integrations relying on legacy-scripting-runner are good candidates too.

} finally {
// TODO is this the correct setup with `finally`, given the logger setup?
// I'm not familiar with how the /input endpoint works.
await logger.end();

@kreddlear kreddlear Apr 3, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to call logger.end() here after everything else in the handler - however, I'm not super familiar with the logger setup or the /input endpoint. Would appreciate feedback if this doesn't look right.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right. Good catch!

Comment thread packages/core/test/tools/promise.js Outdated

@kreddlear kreddlear Apr 3, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are deleting the core/src/tools/promise.js file above, which mostly powers this test file, do we want to delete the test file as well?

The only remaining failing tests are these 3 contextual promise tests. I have not added the ability to "contextify" via a function in this PR, rather context is just handled by pushing up strings to the whatHappened array in _zapier (credit to ChangHung for this idea from the spike PR).

I wasn't able to find a strong reason to have this "contextify" functionality but am open to adding it if it's necessary.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's a reason to keep the "contextify" functionality either. So yeah, let's remove the test file.

@kreddlear
kreddlear marked this pull request as ready for review April 3, 2025 01:18
@kreddlear
kreddlear requested a review from a team as a code owner April 3, 2025 01:18
@kreddlear

kreddlear commented Apr 3, 2025 •

Copy link
Copy Markdown
Contributor Author

@eliangcs 👋 Hello, thanks again for all your help so far! This MR is almost ready for review, I'll spend time tomorrow canarying it using a test platform version to make sure it is fully ready. In the meantime though, I'm wondering if you could take a look at this question above and the failing tests here?

My basic question is if you think it's worth refactoring to keep the logic to pass a function in to "contextify" results, or if we should just remove the test file for ZapierPromise along with the promise.js logic itself. I'd appreciate any thoughts, thank you in advance! And of course if there are any other red flags with the PR that stand out right away, please feel free to bring them to my attention as well, it should be mostly done.

Comment on lines +72 to +77
const maybePromise = func.apply(undefined, args);
// legacy scripting runner returns a Promise for beforeRequest
if (typeof maybePromise !== 'object') {
throw new Error('Middleware should return an object.');
}
newInput = await Promise.resolve(maybePromise);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this promise logic here since the legacy scripting beforeRequest logic can now return a promise.

const runLocally = (event) => {
return new Promise((resolve, reject) => {
const handler = createLambdaHandler(
path.resolve(__dirname, '../test/userapp/index.js'),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have been removed in the previous ESM PR.

@eliangcs eliangcs left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments. I don't see big issues.

I'd like to test it further using zapier invoke, but it didn't work because the previous changes with ESM didn't work well with the zapier invoke implementation in the main branch. I'll solve merge conflict between this and main (work-in-progress PR) and continue my test.

Comment on lines -191 to -199
// Wait for all async events to complete before callback returns.
// This is not strictly necessary since this is the default now when
// using the callback; just putting it here to be explicit.
// In some cases, the code hangs and never exits because the event loop is not
// empty, so we can override the default behavior and exit after the app is done.
context.callbackWaitsForEmptyEventLoop = true;
if (event.skipWaitForAsync === true) {
context.callbackWaitsForEmptyEventLoop = false;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's good to remove callbackWaitsForEmptyEventLoop. 👍

Side note: It's not entirely clear how AWS Lambda behaves when we have unawaited promises with async/await. I did some experimenting and found the following:

  • If an unawaited promise is rejected, Lambda might return an error—but not always. Sometimes the function completes successfully. When it does error and crash, Lambda appears to re-initialize the function on the next invocation.
  • If an unawaited promise resolves successfully, Lambda always returns successfully without waiting for the promise to finish.

With callbacks, the behavior is more predictable:

The function continues to execute until the event loop is empty or the function times out, unless context.callbackWaitsForEmptyEventLoop is set to false.

So it's as if context.callbackWaitsForEmptyEventLoop is now always false when we refactor code from callbacks to async/await. I assume that's fine because we don't rely on callbacks to finish anything in background. The only way to make sure this behavioral difference doesn't break existing integrations is canary testing, I think.

Comment on lines +215 to +217
// This error handler is only called when someone (we or devs) missed
// catching an error in a callback. Errors thrown by promises should be
// already caught by the try-catch below.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add test case(s) to ensure that this is true? That, if a callback throws an error somewhere, this block of code will catch it.

@eliangcs eliangcs Apr 15, 2025 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: I verified it locally by writing a trigger perform method like this:

const perform = async (z, bundle) => {
  setTimeout(() => {
    throw new Error('Random error!');
  }, 1);
  const response = await z.request({
    url: 'https://auth-json-server.zapier-staging.com/recipes',
  });
  return response.data;
};

When running the trigger with zapier invoke trigger recipe --debug, I can see the "Uncaught error: ..." error message.

$ zapier-dev invoke trigger recipe --debug
... (omitted)
  zapier:invoke Uncaught error: Error: Random error!
  zapier:invoke Error: Random error!
  zapier:invoke     at Timeout._onTimeout (/Users/eliang/Projects/zapps/oauth/triggers/recipe.js:3:11)
  zapier:invoke     at listOnTimeout (node:internal/timers:581:17)
  zapier:invoke     at process.processTimers (node:internal/timers:519:7) +18ms
  zapier:invoke {
  zapier:invoke   err: Error: Random error!
  zapier:invoke       at Timeout._onTimeout (/Users/eliang/Projects/zapps/oauth/triggers/recipe.js:3:11)
  zapier:invoke       at listOnTimeout (node:internal/timers:581:17)
  zapier:invoke       at process.processTimers (node:internal/timers:519:7) {
  zapier:invoke     domainThrown: true
  zapier:invoke   },
  zapier:invoke   log_type: 'error',
  zapier:invoke   request_headers: undefined,
  zapier:invoke   response_headers: undefined
  zapier:invoke } +0ms
✖ Invoking triggers.recipe.operation.perform
  oclif:zapier:invoke Error: Random error!
  oclif:zapier:invoke     at Timeout._onTimeout (/Users/eliang/Projects/zapps/oauth/triggers/recipe.js:3:11)
  oclif:zapier:invoke     at listOnTimeout (node:internal/timers:581:17)
  oclif:zapier:invoke     at process.processTimers (node:internal/timers:519:7) +102ms
 ›   Error: Random error!
 ›
 ›   Console logs:
 ›

That means we can expect the uncaught error to be logged.

} finally {
// TODO is this the correct setup with `finally`, given the logger setup?
// I'm not familiar with how the /input endpoint works.
await logger.end();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right. Good catch!

@eliangcs

eliangcs commented Apr 14, 2025 •

Copy link
Copy Markdown
Member

I found some issues while working on #997.

  1. bluebird is still in packages/core/package.json. We should remove it.

  2. It's possible for a developer to use zapier-platform-cli v17 on zapier-platform-core v16. I tried to run zapier validate and zapier describe on an example integration that uses core v16, and saw an error saying Cannot set properties of undefined (setting 'callbackWaitsForEmptyEventLoop'):

$ zapier-dev validate --debug
  oclif:zapier:validate argv is [] +0ms
  oclif:zapier:validate args are {} +1ms
  oclif:zapier:validate flags are { debug: true, format: 'table' } +0ms
  oclif:zapier:validate ------------ +0ms
Validating project locally
  oclif:zapier:validate TypeError: Cannot set properties of undefined (setting 'callbackWaitsForEmptyEventLoop')
  oclif:zapier:validate     at handler (/Users/eliang/Projects/zapps/todoist/node_modules/zapier-platform-core/src/tools/create-lambda-handler.js:195:44)
  oclif:zapier:validate     at /Users/eliang/Projects/zapier-platform/packages/cli/src/utils/local.js:343:18
  oclif:zapier:validate     at localAppCommand (/Users/eliang/Projects/zapier-platform/packages/cli/src/utils/local.js:358:26)
  oclif:zapier:validate     at async ValidateCommand.perform (/Users/eliang/Projects/zapier-platform/packages/cli/src/oclif/commands/validate.js:14:20)
  oclif:zapier:validate     at async Promise.all (index 1)
  oclif:zapier:validate     at async ValidateCommand._run (/Users/eliang/Projects/zapier-platform/node_modules/@oclif/core/lib/command.js:312:22)
  oclif:zapier:validate     at async Config.runCommand (/Users/eliang/Projects/zapier-platform/node_modules/@oclif/core/lib/config/config.js:435:25)
  oclif:zapier:validate     at async run (/Users/eliang/Projects/zapier-platform/node_modules/@oclif/core/lib/main.js:95:16)
  oclif:zapier:validate     at async /Users/eliang/Projects/zapier-platform/packages/cli/src/bin/run:5:3 +67ms
 ›   Error: Cannot set properties of undefined (setting 'callbackWaitsForEmptyEventLoop')

It's because the way localAppCommand calls the Lambda handler is now different. On v16 we call it with a callback, whereas on v17 we call it with await.

For a good developer experience, zapier-platform-cli v17 should work with zapier-platform-core v16. But if that's not possible, we should at least print a clear error message telling the developer to upgrade to zapier-platform-core v17.

@eliangcs

Copy link
Copy Markdown
Member

Update: 2️⃣ mentioned above has been fixed in 1855605, so don't worry about it in this PR.

@eliangcs

Copy link
Copy Markdown
Member

Update: bluebird removed in bcd28a6.

* Bump vite from 5.4.11 to 5.4.14

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.11 to 5.4.14.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.14/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.14/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump vitest from 1.6.0 to 1.6.1

Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v1.6.1/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump vitest from 1.6.0 to 1.6.1 in /schema-to-ts

Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v1.6.1/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* feat(cli): add --authentication-id flag to `invoke` subcommand

* WIP

* Add result to bundle.inputData

* spread keys to root obj

* Addition of OpenAI Example App

* Addition of OpenAI Template Generator

* If authId, don't warn about empty .env

* Update changelog

* Bump cli, core, schema 16.3.0 -> 16.3.1

* fix(cli): location of SyntaxError not showing even if --debug is on

* WIP

* Add middleware

* Remove --inspect and debugger

* invoke: Don't explode when .zapierapprc is missing

* Edit invoke command help

* [PDE-5913] fix(schema): Update schema doc url template to reference GitHub markdown (#984)

* fix schema doc url template

* fix test

* Auxiliary line removed.

---------

Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>

* Fix typo

* Add examples

* Load .env even in relay mode

* Object ID could be 0

* [PDE-5886] feat(cli): Add warning to `zapier deprecate` command (#985)

* updates to deprecate command

* support -f flag

* Update packages/cli/src/oclif/commands/deprecate.js

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Update packages/cli/src/oclif/commands/deprecate.js

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Update packages/cli/docs/cli.md

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

---------

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Add command to mark integration version as legacy

* Don't send authorization header in `zapier invoke` relay mode

* Improve invoke help doc

* use same language

* Update docs

* Link to a doc with the instructions on how to find auth IDs

* Add 16.4.0 changelog

* Bump cli, core, schema 16.3.1 -> 16.4.0

* update changelog

* return state instead of deployment

* Remove migration nudge on promote

* Add changelog

* Add spotlight msg

* Bump cli, core, schema 16.4.0 -> 16.5.0

* Fix `zapier invoke` in v17

* Fix bug where cli v17 doesn't work with core v16

* Resolve conflict in example app

* Remove reload from getLocalAppHandler, fix for Node.js 22

* Remove bluebird

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>
Co-authored-by: Stanley Chin <stan.chin@zapier.com>
Co-authored-by: Brody Berson <brody.berson@zapier.com>
Co-authored-by: Brody Berson <2766432+mynamebrody@users.noreply.github.com>
Co-authored-by: Raúl Negrón <rnegron@users.noreply.github.com>
Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>
Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>
Co-authored-by: Raúl Negrón <raul.negron@zapier.com>

@eliangcs eliangcs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me now. There's a merge conflict with schema.md. Once you resolve it, feel free to merge. Thanks for the great work!

@kreddlear

Copy link
Copy Markdown
Contributor Author

Thanks so much @eliangcs ! I resolved the conflict and added some test cases for the Uncaught error vs Unhandled error logging per your comment here - I had also confirmed the behavior locally, but it seems good to have that confirmed in tests as well. I'll merge this into v17 and continue canary testing 👍

@eliangcs eliangcs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the test!

@kreddlear
kreddlear merged commit 9a76630 into zapier-platform-major-release-17.0.0-dev Apr 21, 2025
@kreddlear
kreddlear deleted the pde-5261-replace-bluebird branch April 21, 2025 17:04
kreddlear added a commit that referenced this pull request May 9, 2025
* create release branch

* cli(chore): Remove browserify, replace with esbuild [PDE-5243] (#946)

* remove browserify, replace with esbuild

* feat(schema): PDE-5719 split FieldSchema into InputFieldSchema, OutputFieldSchema, and AuthFieldSchema (#957)

* first attempt: split FieldSchema

* PDE-5719 address PR comments

* PDE-5719 address commented out lines

* PDE-5719 address commented out lines

* PDE-5719 clean up

* PDE-5719 clean up

* rename to AuthFieldSchema

* PR suggestions: remove cleanErrors addition

* PR suggestions: add examples and anti-examples

* fix description

* remove FieldsSchema and DynamicFieldsSchema

* add unit tests

* update unit test

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldsSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldsSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldsSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldsSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldsSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* run yarn build

* PR suggestion: move isSafe check as a functional-contsraint

* update test

* Update packages/schema/test/index.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/test/index.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/test/index.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/utils/makeValidator.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* update FORBIDDEN_KEYS to match secret scrubber

* PR suggestions: tailor fields to not inherit from FieldSchema

* run yarn build

* PR suggestions: remove uneeded fields and fix tests

* PR suggestion:rename to isNotSecret

* PDE-5719 add helpText back to inputField

* update type enums for better fit

* apply PR suggestions

* apply PR suggestions

* remove copy from auth types

* add default back to input and output schema

* update docs

* apply PR suggestions

* apply PR suggestions

* PR suggestion: use common fields and update schemas

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/OutputFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/test/index.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/FieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/InputFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Split FieldSchema into AuthFieldSchema, InputFieldSchema, OutputFieldSchema

* add examples/anti-examples back for FieldSchema

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

---------

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* PDE-5773 Reference the proper FieldSchema as necessary

* PDE-5774 fix(core): Catch HTTP 500 along with status codes >500 in RPC client (#974)

* HTTP 500 is no longer expected

* fix test

* update test logic

* PDE-5810 add copy to AuthFieldSchema (#977)

* remove bluebird, replace with native promises

* add comments and initial whatHappened in middleware

* update middleware to remove .then

* feat(cli, core): Add ESM support to CLI and platform-core [PDE-5244] (#965)

* initial require removal

* update zapierwrapper

* further replace require with import, remove index.js hardcoding

* further remove index.js references

* re-add index.js

* re-add index.js in cli as well

* add index.js specifically to runLocally tests

* add example esm app, copy dir to fix broken import

* update zapierwrapper to mjs

* Separate zapierwrapper.js into CommonJS and ESM

* Fix failing tests

* Remove debugger

* Rename zapierwrapper.cjs back to zapierwrapper.js

So it'll work for previous versions of zapier-platform-cli.

* Add TODO

* retrieve package name from package.json

* add esm test case

* PDE-5244 fix(cli,core): make zapierwrapper.mjs statically analyzable, more test cases (#982)

* zapierwrapper.mjs should be statically analyzable

* Show location of SyntaxError

* Fix issue where index.js is missing for CJS build

* Add index.js only if exists

* remove esmodule app

* remove esmodule app test along with esmodule test

---------

Co-authored-by: Chang-Hung Liang <chang-hung.liang@zapier.com>

* merge main into v17 branch

* add try/catch and enrich error message

* fix logging hang detection and error handling logic + tests

* feat(cli): Add ESM support to `zapier init` command for Minimal and Typescript templates [PDE-5248] (#976)

* initial updates for init

* update smoke tests, add module option to env

* update test to include module flag

* update typescript init + tests

* add example apps

* add build.js test for typescript-esm example app

* update test required files number

* PR feedback - fix generator code, upgrade gulp-prettier, update eslint config

* update example apps

* update build ESM test to match typescript-esm template

* consolidate typescript templates, update generator, regenerate example-apps

* update shouldDeleteWrapper to default to true

* PDE-5248 test(cli): include ESM templates to smoke tests (#986)

* Include ESM templates to smoke tests

* Change example app title to 'minimal-esm'

* Better error message when zapierwrapper.mjs can't be found

---------

Co-authored-by: Chang-Hung Liang <chang-hung.liang@zapier.com>

* convert more functions to async/await

* fix localAppCommand logic

* fix failing tests - use local core for workspace tests, check for existing bundle for whatHappened

* remove promise file, clean up console logs, fix typos

* remove empty context, add default

* remove todo

* feat( schema ): update dynamic type to include functions and requests (#979)

* regenerate files

* swap search for dynamic

* BREAKING CHANGE(schema): Merge shouldLock deprecation into v17 release branch [PDE-5590] (#988)

* PDE-4241 Deprecate shouldLock

* PDE-4241 Update lock description

---------

Co-authored-by: kola-er <kola.erinoso@zapier.com>
Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* remove promise tests

* fix middleware to handle legacy scripting

* check the keys length not object length

* Rename InputFieldSchema to PlainInputField Schema

* Rename Ouput and (base) Field schemas with "Plain"

* Rename DynamicInputFields to InputFields

* Rename DynamicOutputFields to OutputFields

* Remove lockfile

* Create dedicated SeparateOperation Schema

This will help with downstream types later.

* Bump expected file number in tests for new schema

* Make CreateOperation name consistent with others

* PDE-5261 chore: native promise with updates from main branch (#997)

* Bump vite from 5.4.11 to 5.4.14

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.11 to 5.4.14.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.14/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.14/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump vitest from 1.6.0 to 1.6.1

Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v1.6.1/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump vitest from 1.6.0 to 1.6.1 in /schema-to-ts

Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v1.6.1/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* feat(cli): add --authentication-id flag to `invoke` subcommand

* WIP

* Add result to bundle.inputData

* spread keys to root obj

* Addition of OpenAI Example App

* Addition of OpenAI Template Generator

* If authId, don't warn about empty .env

* Update changelog

* Bump cli, core, schema 16.3.0 -> 16.3.1

* fix(cli): location of SyntaxError not showing even if --debug is on

* WIP

* Add middleware

* Remove --inspect and debugger

* invoke: Don't explode when .zapierapprc is missing

* Edit invoke command help

* [PDE-5913] fix(schema): Update schema doc url template to reference GitHub markdown (#984)

* fix schema doc url template

* fix test

* Auxiliary line removed.

---------

Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>

* Fix typo

* Add examples

* Load .env even in relay mode

* Object ID could be 0

* [PDE-5886] feat(cli): Add warning to `zapier deprecate` command (#985)

* updates to deprecate command

* support -f flag

* Update packages/cli/src/oclif/commands/deprecate.js

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Update packages/cli/src/oclif/commands/deprecate.js

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Update packages/cli/docs/cli.md

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

---------

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Add command to mark integration version as legacy

* Don't send authorization header in `zapier invoke` relay mode

* Improve invoke help doc

* use same language

* Update docs

* Link to a doc with the instructions on how to find auth IDs

* Add 16.4.0 changelog

* Bump cli, core, schema 16.3.1 -> 16.4.0

* update changelog

* return state instead of deployment

* Remove migration nudge on promote

* Add changelog

* Add spotlight msg

* Bump cli, core, schema 16.4.0 -> 16.5.0

* Fix `zapier invoke` in v17

* Fix bug where cli v17 doesn't work with core v16

* Resolve conflict in example app

* Remove reload from getLocalAppHandler, fix for Node.js 22

* Remove bluebird

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>
Co-authored-by: Stanley Chin <stan.chin@zapier.com>
Co-authored-by: Brody Berson <brody.berson@zapier.com>
Co-authored-by: Brody Berson <2766432+mynamebrody@users.noreply.github.com>
Co-authored-by: Raúl Negrón <rnegron@users.noreply.github.com>
Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>
Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>
Co-authored-by: Raúl Negrón <raul.negron@zapier.com>

* Don't replace everything in request object

* fix(core): PDE-6038 trim newline and whitespaces from request header (#1000)

* PDE-6038 add sanatize header middleware

* add file

* fix test

* address review comments

* add line back

* BREAKING CHANGE(core): Remove Bluebird, replace with native promises (#980)

* remove bluebird, replace with native promises

* add comments and initial whatHappened in middleware

* update middleware to remove .then

* add try/catch and enrich error message

* fix logging hang detection and error handling logic + tests

* convert more functions to async/await

* fix localAppCommand logic

* fix failing tests - use local core for workspace tests, check for existing bundle for whatHappened

* remove promise file, clean up console logs, fix typos

* remove empty context, add default

* remove todo

* remove promise tests

* fix middleware to handle legacy scripting

* check the keys length not object length

* PDE-5261 chore: native promise with updates from main branch (#997)

* Bump vite from 5.4.11 to 5.4.14

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.11 to 5.4.14.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.14/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.14/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump vitest from 1.6.0 to 1.6.1

Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v1.6.1/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump vitest from 1.6.0 to 1.6.1 in /schema-to-ts

Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v1.6.1/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* feat(cli): add --authentication-id flag to `invoke` subcommand

* WIP

* Add result to bundle.inputData

* spread keys to root obj

* Addition of OpenAI Example App

* Addition of OpenAI Template Generator

* If authId, don't warn about empty .env

* Update changelog

* Bump cli, core, schema 16.3.0 -> 16.3.1

* fix(cli): location of SyntaxError not showing even if --debug is on

* WIP

* Add middleware

* Remove --inspect and debugger

* invoke: Don't explode when .zapierapprc is missing

* Edit invoke command help

* [PDE-5913] fix(schema): Update schema doc url template to reference GitHub markdown (#984)

* fix schema doc url template

* fix test

* Auxiliary line removed.

---------

Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>

* Fix typo

* Add examples

* Load .env even in relay mode

* Object ID could be 0

* [PDE-5886] feat(cli): Add warning to `zapier deprecate` command (#985)

* updates to deprecate command

* support -f flag

* Update packages/cli/src/oclif/commands/deprecate.js

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Update packages/cli/src/oclif/commands/deprecate.js

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Update packages/cli/docs/cli.md

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

---------

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Add command to mark integration version as legacy

* Don't send authorization header in `zapier invoke` relay mode

* Improve invoke help doc

* use same language

* Update docs

* Link to a doc with the instructions on how to find auth IDs

* Add 16.4.0 changelog

* Bump cli, core, schema 16.3.1 -> 16.4.0

* update changelog

* return state instead of deployment

* Remove migration nudge on promote

* Add changelog

* Add spotlight msg

* Bump cli, core, schema 16.4.0 -> 16.5.0

* Fix `zapier invoke` in v17

* Fix bug where cli v17 doesn't work with core v16

* Resolve conflict in example app

* Remove reload from getLocalAppHandler, fix for Node.js 22

* Remove bluebird

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>
Co-authored-by: Stanley Chin <stan.chin@zapier.com>
Co-authored-by: Brody Berson <brody.berson@zapier.com>
Co-authored-by: Brody Berson <2766432+mynamebrody@users.noreply.github.com>
Co-authored-by: Raúl Negrón <rnegron@users.noreply.github.com>
Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>
Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>
Co-authored-by: Raúl Negrón <raul.negron@zapier.com>

* add uncaught + unhandled error test cases

* update type test file

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Chang-Hung Liang <chang-hung.liang@zapier.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>
Co-authored-by: Stanley Chin <stan.chin@zapier.com>
Co-authored-by: Brody Berson <brody.berson@zapier.com>
Co-authored-by: Brody Berson <2766432+mynamebrody@users.noreply.github.com>
Co-authored-by: Raúl Negrón <rnegron@users.noreply.github.com>
Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>
Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>
Co-authored-by: Raúl Negrón <raul.negron@zapier.com>

* Make z.request() throw for curlies by default

* legacy-scripting-runner still needs {{curlies}} replacement

* PDE-6051 add back integer type (#1002)

* add computed field back to input field schema (#1003)

* PDE-6065 add canPaginate to inputFields, add func-constraint as well (#1004)

* chore(schema): PDE-6090 revert dynamic dropdown (#1005)

* Revert dyanmic dropdown extenstion

* remove unused import

* update description

* Remove `zapier` prefix from type modules

* Bump schema-to-ts dependencies

* Switch compiled types to tsx, ~2x speedup

* Remove timestamps from schema compiler logs

* Rename main.ts to compiler.ts

Because that's what it really is

* Rename CLI to main

* Switch to @commander-js/extra-typings

* Fix more old module names

* Minor typing improvement

* Minor tweaks to imports and shebang

* Add inputs.d.ts, supporting Bundle shape inference

* First pass of different perform functions

* Simplify and make stricter schema-to-ts tsconfig

* schema-to-ts V2 experiment

* Improve schema-to-ts v2 interface generation

* Begin generalising rawType rendering

* Massively simplify schema-to-ts v2 again

* Add preamble to V2 output

* Add import handling

* Add middleware patching plugins

* Simply plugins, complete function types

* Ad string enum support

* Fix arrays of unions

* Initial Type Arg (generic) plugins

* Minor Docs improvements

* Use schema-to-ts plugins to split trigger types & add input generics

* Add HookToPoll function types

* Import perform function types to generated module

* Thread generics through Triggers, Creates, & Searches

* Introduce schema-to-ts v3, and remove v1 & v2

This takes many of the improvements made in the v2 schema-to-ts
compiler, and refactors them to a radically simpler yet again system.
The plugin system is gone, and a tree of "overrides" is now defined in
constants.ts that lets any type be patched with either a string
replacement, a partial set of options to give to apply to the ts-morph
call, or a function that can take full control of what gets rendered.

* Add crash for unused overrides, and add flag to ignore

* Update compiler for new & better schema names

* Integrate new schema types and upgrade tests

Still more to do, but making use of the changes from PR#998

* Support "ignore" symbols in schema-to-ts overrides

* Add $Key generics to T/C/S actions

* Experiment with define() helpers

* Type improvements, and add define helpers

* Narrow Bundle types to Record<string, unknown> by default

* Improve docs and imports for types

* Omit the Triggers, Creates, & Searches schemas that are unused

* Rename constants.ts to overrides.ts, for clarity

* Update schema-to-ts README with up-to-date info

* Restore main ZPC type tests (post-rebase conflicts)

* Remove pnpm lock

* Remove unused comments from perform function types

* Clarify nomenclature in inputs.d.ts

* All searches to return >1 item in array

* refactor to `defineInputFields` to improve consistency

* Add `defineSearch` helper functions

* Add singular `defineInputField` helper to ZPC

* Update yarn lockfile

* Fix define helper import tests

* Fix CreatePerform default type

* Fix TS build CLI tests

* Update TS templates with v17 TS patterns

* Update TS scaffold commands with v17 TS patterns

* chore(cli, schema, core): Update dependencies [PDE-5965] (#1010)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Natay Aberra <natay.aberra@gmail.com>
Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>
Co-authored-by: Kolawole Erinoso <kola.erinoso@gmail.com>
Co-authored-by: Raúl Negrón <rnegron@users.noreply.github.com>
Co-authored-by: Chang-Hung Liang <chang-hung.liang@zapier.com>
Co-authored-by: kola-er <kola.erinoso@zapier.com>
Co-authored-by: Thomas Cranny <thomas.cranny@zapier.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Stanley Chin <stan.chin@zapier.com>
Co-authored-by: Brody Berson <brody.berson@zapier.com>
Co-authored-by: Brody Berson <2766432+mynamebrody@users.noreply.github.com>
Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>
Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>
Co-authored-by: Raúl Negrón <raul.negron@zapier.com>
kreddlear added a commit that referenced this pull request May 12, 2025
* create release branch

* update changelog

* update changelog - schema changes

* update changelog with schema-to-ts updates

* update changelog

* update changelog emojis

* [PDE-5960] chore(all): v17 release development branch (#1006)

* create release branch

* cli(chore): Remove browserify, replace with esbuild [PDE-5243] (#946)

* remove browserify, replace with esbuild

* feat(schema): PDE-5719 split FieldSchema into InputFieldSchema, OutputFieldSchema, and AuthFieldSchema (#957)

* first attempt: split FieldSchema

* PDE-5719 address PR comments

* PDE-5719 address commented out lines

* PDE-5719 address commented out lines

* PDE-5719 clean up

* PDE-5719 clean up

* rename to AuthFieldSchema

* PR suggestions: remove cleanErrors addition

* PR suggestions: add examples and anti-examples

* fix description

* remove FieldsSchema and DynamicFieldsSchema

* add unit tests

* update unit test

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldsSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldsSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldsSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldsSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldsSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* run yarn build

* PR suggestion: move isSafe check as a functional-contsraint

* update test

* Update packages/schema/test/index.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/test/index.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/test/index.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/utils/makeValidator.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* update FORBIDDEN_KEYS to match secret scrubber

* PR suggestions: tailor fields to not inherit from FieldSchema

* run yarn build

* PR suggestions: remove uneeded fields and fix tests

* PR suggestion:rename to isNotSecret

* PDE-5719 add helpText back to inputField

* update type enums for better fit

* apply PR suggestions

* apply PR suggestions

* remove copy from auth types

* add default back to input and output schema

* update docs

* apply PR suggestions

* apply PR suggestions

* PR suggestion: use common fields and update schemas

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/OutputFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/test/index.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/FieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/InputFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Split FieldSchema into AuthFieldSchema, InputFieldSchema, OutputFieldSchema

* add examples/anti-examples back for FieldSchema

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

---------

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* PDE-5773 Reference the proper FieldSchema as necessary

* PDE-5774 fix(core): Catch HTTP 500 along with status codes >500 in RPC client (#974)

* HTTP 500 is no longer expected

* fix test

* update test logic

* PDE-5810 add copy to AuthFieldSchema (#977)

* remove bluebird, replace with native promises

* add comments and initial whatHappened in middleware

* update middleware to remove .then

* feat(cli, core): Add ESM support to CLI and platform-core [PDE-5244] (#965)

* initial require removal

* update zapierwrapper

* further replace require with import, remove index.js hardcoding

* further remove index.js references

* re-add index.js

* re-add index.js in cli as well

* add index.js specifically to runLocally tests

* add example esm app, copy dir to fix broken import

* update zapierwrapper to mjs

* Separate zapierwrapper.js into CommonJS and ESM

* Fix failing tests

* Remove debugger

* Rename zapierwrapper.cjs back to zapierwrapper.js

So it'll work for previous versions of zapier-platform-cli.

* Add TODO

* retrieve package name from package.json

* add esm test case

* PDE-5244 fix(cli,core): make zapierwrapper.mjs statically analyzable, more test cases (#982)

* zapierwrapper.mjs should be statically analyzable

* Show location of SyntaxError

* Fix issue where index.js is missing for CJS build

* Add index.js only if exists

* remove esmodule app

* remove esmodule app test along with esmodule test

---------

Co-authored-by: Chang-Hung Liang <chang-hung.liang@zapier.com>

* merge main into v17 branch

* add try/catch and enrich error message

* fix logging hang detection and error handling logic + tests

* feat(cli): Add ESM support to `zapier init` command for Minimal and Typescript templates [PDE-5248] (#976)

* initial updates for init

* update smoke tests, add module option to env

* update test to include module flag

* update typescript init + tests

* add example apps

* add build.js test for typescript-esm example app

* update test required files number

* PR feedback - fix generator code, upgrade gulp-prettier, update eslint config

* update example apps

* update build ESM test to match typescript-esm template

* consolidate typescript templates, update generator, regenerate example-apps

* update shouldDeleteWrapper to default to true

* PDE-5248 test(cli): include ESM templates to smoke tests (#986)

* Include ESM templates to smoke tests

* Change example app title to 'minimal-esm'

* Better error message when zapierwrapper.mjs can't be found

---------

Co-authored-by: Chang-Hung Liang <chang-hung.liang@zapier.com>

* convert more functions to async/await

* fix localAppCommand logic

* fix failing tests - use local core for workspace tests, check for existing bundle for whatHappened

* remove promise file, clean up console logs, fix typos

* remove empty context, add default

* remove todo

* feat( schema ): update dynamic type to include functions and requests (#979)

* regenerate files

* swap search for dynamic

* BREAKING CHANGE(schema): Merge shouldLock deprecation into v17 release branch [PDE-5590] (#988)

* PDE-4241 Deprecate shouldLock

* PDE-4241 Update lock description

---------

Co-authored-by: kola-er <kola.erinoso@zapier.com>
Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* remove promise tests

* fix middleware to handle legacy scripting

* check the keys length not object length

* Rename InputFieldSchema to PlainInputField Schema

* Rename Ouput and (base) Field schemas with "Plain"

* Rename DynamicInputFields to InputFields

* Rename DynamicOutputFields to OutputFields

* Remove lockfile

* Create dedicated SeparateOperation Schema

This will help with downstream types later.

* Bump expected file number in tests for new schema

* Make CreateOperation name consistent with others

* PDE-5261 chore: native promise with updates from main branch (#997)

* Bump vite from 5.4.11 to 5.4.14

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.11 to 5.4.14.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.14/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.14/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump vitest from 1.6.0 to 1.6.1

Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v1.6.1/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump vitest from 1.6.0 to 1.6.1 in /schema-to-ts

Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v1.6.1/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* feat(cli): add --authentication-id flag to `invoke` subcommand

* WIP

* Add result to bundle.inputData

* spread keys to root obj

* Addition of OpenAI Example App

* Addition of OpenAI Template Generator

* If authId, don't warn about empty .env

* Update changelog

* Bump cli, core, schema 16.3.0 -> 16.3.1

* fix(cli): location of SyntaxError not showing even if --debug is on

* WIP

* Add middleware

* Remove --inspect and debugger

* invoke: Don't explode when .zapierapprc is missing

* Edit invoke command help

* [PDE-5913] fix(schema): Update schema doc url template to reference GitHub markdown (#984)

* fix schema doc url template

* fix test

* Auxiliary line removed.

---------

Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>

* Fix typo

* Add examples

* Load .env even in relay mode

* Object ID could be 0

* [PDE-5886] feat(cli): Add warning to `zapier deprecate` command (#985)

* updates to deprecate command

* support -f flag

* Update packages/cli/src/oclif/commands/deprecate.js

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Update packages/cli/src/oclif/commands/deprecate.js

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Update packages/cli/docs/cli.md

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

---------

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Add command to mark integration version as legacy

* Don't send authorization header in `zapier invoke` relay mode

* Improve invoke help doc

* use same language

* Update docs

* Link to a doc with the instructions on how to find auth IDs

* Add 16.4.0 changelog

* Bump cli, core, schema 16.3.1 -> 16.4.0

* update changelog

* return state instead of deployment

* Remove migration nudge on promote

* Add changelog

* Add spotlight msg

* Bump cli, core, schema 16.4.0 -> 16.5.0

* Fix `zapier invoke` in v17

* Fix bug where cli v17 doesn't work with core v16

* Resolve conflict in example app

* Remove reload from getLocalAppHandler, fix for Node.js 22

* Remove bluebird

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>
Co-authored-by: Stanley Chin <stan.chin@zapier.com>
Co-authored-by: Brody Berson <brody.berson@zapier.com>
Co-authored-by: Brody Berson <2766432+mynamebrody@users.noreply.github.com>
Co-authored-by: Raúl Negrón <rnegron@users.noreply.github.com>
Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>
Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>
Co-authored-by: Raúl Negrón <raul.negron@zapier.com>

* Don't replace everything in request object

* fix(core): PDE-6038 trim newline and whitespaces from request header (#1000)

* PDE-6038 add sanatize header middleware

* add file

* fix test

* address review comments

* add line back

* BREAKING CHANGE(core): Remove Bluebird, replace with native promises (#980)

* remove bluebird, replace with native promises

* add comments and initial whatHappened in middleware

* update middleware to remove .then

* add try/catch and enrich error message

* fix logging hang detection and error handling logic + tests

* convert more functions to async/await

* fix localAppCommand logic

* fix failing tests - use local core for workspace tests, check for existing bundle for whatHappened

* remove promise file, clean up console logs, fix typos

* remove empty context, add default

* remove todo

* remove promise tests

* fix middleware to handle legacy scripting

* check the keys length not object length

* PDE-5261 chore: native promise with updates from main branch (#997)

* Bump vite from 5.4.11 to 5.4.14

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.11 to 5.4.14.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.14/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.14/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump vitest from 1.6.0 to 1.6.1

Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v1.6.1/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump vitest from 1.6.0 to 1.6.1 in /schema-to-ts

Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v1.6.1/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* feat(cli): add --authentication-id flag to `invoke` subcommand

* WIP

* Add result to bundle.inputData

* spread keys to root obj

* Addition of OpenAI Example App

* Addition of OpenAI Template Generator

* If authId, don't warn about empty .env

* Update changelog

* Bump cli, core, schema 16.3.0 -> 16.3.1

* fix(cli): location of SyntaxError not showing even if --debug is on

* WIP

* Add middleware

* Remove --inspect and debugger

* invoke: Don't explode when .zapierapprc is missing

* Edit invoke command help

* [PDE-5913] fix(schema): Update schema doc url template to reference GitHub markdown (#984)

* fix schema doc url template

* fix test

* Auxiliary line removed.

---------

Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>

* Fix typo

* Add examples

* Load .env even in relay mode

* Object ID could be 0

* [PDE-5886] feat(cli): Add warning to `zapier deprecate` command (#985)

* updates to deprecate command

* support -f flag

* Update packages/cli/src/oclif/commands/deprecate.js

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Update packages/cli/src/oclif/commands/deprecate.js

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Update packages/cli/docs/cli.md

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

---------

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Add command to mark integration version as legacy

* Don't send authorization header in `zapier invoke` relay mode

* Improve invoke help doc

* use same language

* Update docs

* Link to a doc with the instructions on how to find auth IDs

* Add 16.4.0 changelog

* Bump cli, core, schema 16.3.1 -> 16.4.0

* update changelog

* return state instead of deployment

* Remove migration nudge on promote

* Add changelog

* Add spotlight msg

* Bump cli, core, schema 16.4.0 -> 16.5.0

* Fix `zapier invoke` in v17

* Fix bug where cli v17 doesn't work with core v16

* Resolve conflict in example app

* Remove reload from getLocalAppHandler, fix for Node.js 22

* Remove bluebird

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>
Co-authored-by: Stanley Chin <stan.chin@zapier.com>
Co-authored-by: Brody Berson <brody.berson@zapier.com>
Co-authored-by: Brody Berson <2766432+mynamebrody@users.noreply.github.com>
Co-authored-by: Raúl Negrón <rnegron@users.noreply.github.com>
Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>
Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>
Co-authored-by: Raúl Negrón <raul.negron@zapier.com>

* add uncaught + unhandled error test cases

* update type test file

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Chang-Hung Liang <chang-hung.liang@zapier.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>
Co-authored-by: Stanley Chin <stan.chin@zapier.com>
Co-authored-by: Brody Berson <brody.berson@zapier.com>
Co-authored-by: Brody Berson <2766432+mynamebrody@users.noreply.github.com>
Co-authored-by: Raúl Negrón <rnegron@users.noreply.github.com>
Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>
Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>
Co-authored-by: Raúl Negrón <raul.negron@zapier.com>

* Make z.request() throw for curlies by default

* legacy-scripting-runner still needs {{curlies}} replacement

* PDE-6051 add back integer type (#1002)

* add computed field back to input field schema (#1003)

* PDE-6065 add canPaginate to inputFields, add func-constraint as well (#1004)

* chore(schema): PDE-6090 revert dynamic dropdown (#1005)

* Revert dyanmic dropdown extenstion

* remove unused import

* update description

* Remove `zapier` prefix from type modules

* Bump schema-to-ts dependencies

* Switch compiled types to tsx, ~2x speedup

* Remove timestamps from schema compiler logs

* Rename main.ts to compiler.ts

Because that's what it really is

* Rename CLI to main

* Switch to @commander-js/extra-typings

* Fix more old module names

* Minor typing improvement

* Minor tweaks to imports and shebang

* Add inputs.d.ts, supporting Bundle shape inference

* First pass of different perform functions

* Simplify and make stricter schema-to-ts tsconfig

* schema-to-ts V2 experiment

* Improve schema-to-ts v2 interface generation

* Begin generalising rawType rendering

* Massively simplify schema-to-ts v2 again

* Add preamble to V2 output

* Add import handling

* Add middleware patching plugins

* Simply plugins, complete function types

* Ad string enum support

* Fix arrays of unions

* Initial Type Arg (generic) plugins

* Minor Docs improvements

* Use schema-to-ts plugins to split trigger types & add input generics

* Add HookToPoll function types

* Import perform function types to generated module

* Thread generics through Triggers, Creates, & Searches

* Introduce schema-to-ts v3, and remove v1 & v2

This takes many of the improvements made in the v2 schema-to-ts
compiler, and refactors them to a radically simpler yet again system.
The plugin system is gone, and a tree of "overrides" is now defined in
constants.ts that lets any type be patched with either a string
replacement, a partial set of options to give to apply to the ts-morph
call, or a function that can take full control of what gets rendered.

* Add crash for unused overrides, and add flag to ignore

* Update compiler for new & better schema names

* Integrate new schema types and upgrade tests

Still more to do, but making use of the changes from PR#998

* Support "ignore" symbols in schema-to-ts overrides

* Add $Key generics to T/C/S actions

* Experiment with define() helpers

* Type improvements, and add define helpers

* Narrow Bundle types to Record<string, unknown> by default

* Improve docs and imports for types

* Omit the Triggers, Creates, & Searches schemas that are unused

* Rename constants.ts to overrides.ts, for clarity

* Update schema-to-ts README with up-to-date info

* Restore main ZPC type tests (post-rebase conflicts)

* Remove pnpm lock

* Remove unused comments from perform function types

* Clarify nomenclature in inputs.d.ts

* All searches to return >1 item in array

* refactor to `defineInputFields` to improve consistency

* Add `defineSearch` helper functions

* Add singular `defineInputField` helper to ZPC

* Update yarn lockfile

* Fix define helper import tests

* Fix CreatePerform default type

* Fix TS build CLI tests

* Update TS templates with v17 TS patterns

* Update TS scaffold commands with v17 TS patterns

* chore(cli, schema, core): Update dependencies [PDE-5965] (#1010)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Natay Aberra <natay.aberra@gmail.com>
Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>
Co-authored-by: Kolawole Erinoso <kola.erinoso@gmail.com>
Co-authored-by: Raúl Negrón <rnegron@users.noreply.github.com>
Co-authored-by: Chang-Hung Liang <chang-hung.liang@zapier.com>
Co-authored-by: kola-er <kola.erinoso@zapier.com>
Co-authored-by: Thomas Cranny <thomas.cranny@zapier.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Stanley Chin <stan.chin@zapier.com>
Co-authored-by: Brody Berson <brody.berson@zapier.com>
Co-authored-by: Brody Berson <2766432+mynamebrody@users.noreply.github.com>
Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>
Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>
Co-authored-by: Raúl Negrón <raul.negron@zapier.com>

* Bump cli, core, schema 16.5.1 -> 17.0.0

* generated schemas

* Bump legacy-scripting-runner 3.8.14 -> 3.8.15

* revert legacy scripting runner update

* update workspace test to use npmPackCore

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Natay Aberra <natay.aberra@gmail.com>
Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>
Co-authored-by: Kolawole Erinoso <kola.erinoso@gmail.com>
Co-authored-by: Raúl Negrón <rnegron@users.noreply.github.com>
Co-authored-by: Chang-Hung Liang <chang-hung.liang@zapier.com>
Co-authored-by: kola-er <kola.erinoso@zapier.com>
Co-authored-by: Thomas Cranny <thomas.cranny@zapier.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Stanley Chin <stan.chin@zapier.com>
Co-authored-by: Brody Berson <brody.berson@zapier.com>
Co-authored-by: Brody Berson <2766432+mynamebrody@users.noreply.github.com>
Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>
Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>
Co-authored-by: Raúl Negrón <raul.negron@zapier.com>
kreddlear added a commit that referenced this pull request May 12, 2025
…15 (#1015)

* create release branch

* update changelog

* update changelog - schema changes

* update changelog with schema-to-ts updates

* update changelog

* update changelog emojis

* [PDE-5960] chore(all): v17 release development branch (#1006)

* create release branch

* cli(chore): Remove browserify, replace with esbuild [PDE-5243] (#946)

* remove browserify, replace with esbuild

* feat(schema): PDE-5719 split FieldSchema into InputFieldSchema, OutputFieldSchema, and AuthFieldSchema (#957)

* first attempt: split FieldSchema

* PDE-5719 address PR comments

* PDE-5719 address commented out lines

* PDE-5719 address commented out lines

* PDE-5719 clean up

* PDE-5719 clean up

* rename to AuthFieldSchema

* PR suggestions: remove cleanErrors addition

* PR suggestions: add examples and anti-examples

* fix description

* remove FieldsSchema and DynamicFieldsSchema

* add unit tests

* update unit test

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldsSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldsSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldsSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldsSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldsSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* run yarn build

* PR suggestion: move isSafe check as a functional-contsraint

* update test

* Update packages/schema/test/index.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/test/index.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/test/index.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/utils/makeValidator.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* update FORBIDDEN_KEYS to match secret scrubber

* PR suggestions: tailor fields to not inherit from FieldSchema

* run yarn build

* PR suggestions: remove uneeded fields and fix tests

* PR suggestion:rename to isNotSecret

* PDE-5719 add helpText back to inputField

* update type enums for better fit

* apply PR suggestions

* apply PR suggestions

* remove copy from auth types

* add default back to input and output schema

* update docs

* apply PR suggestions

* apply PR suggestions

* PR suggestion: use common fields and update schemas

* Update packages/schema/lib/functional-constraints/AuthFieldisSafe.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/OutputFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/test/index.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/FieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Update packages/schema/lib/schemas/InputFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* Split FieldSchema into AuthFieldSchema, InputFieldSchema, OutputFieldSchema

* add examples/anti-examples back for FieldSchema

* Update packages/schema/lib/schemas/AuthFieldSchema.js

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

---------

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* PDE-5773 Reference the proper FieldSchema as necessary

* PDE-5774 fix(core): Catch HTTP 500 along with status codes >500 in RPC client (#974)

* HTTP 500 is no longer expected

* fix test

* update test logic

* PDE-5810 add copy to AuthFieldSchema (#977)

* remove bluebird, replace with native promises

* add comments and initial whatHappened in middleware

* update middleware to remove .then

* feat(cli, core): Add ESM support to CLI and platform-core [PDE-5244] (#965)

* initial require removal

* update zapierwrapper

* further replace require with import, remove index.js hardcoding

* further remove index.js references

* re-add index.js

* re-add index.js in cli as well

* add index.js specifically to runLocally tests

* add example esm app, copy dir to fix broken import

* update zapierwrapper to mjs

* Separate zapierwrapper.js into CommonJS and ESM

* Fix failing tests

* Remove debugger

* Rename zapierwrapper.cjs back to zapierwrapper.js

So it'll work for previous versions of zapier-platform-cli.

* Add TODO

* retrieve package name from package.json

* add esm test case

* PDE-5244 fix(cli,core): make zapierwrapper.mjs statically analyzable, more test cases (#982)

* zapierwrapper.mjs should be statically analyzable

* Show location of SyntaxError

* Fix issue where index.js is missing for CJS build

* Add index.js only if exists

* remove esmodule app

* remove esmodule app test along with esmodule test

---------

Co-authored-by: Chang-Hung Liang <chang-hung.liang@zapier.com>

* merge main into v17 branch

* add try/catch and enrich error message

* fix logging hang detection and error handling logic + tests

* feat(cli): Add ESM support to `zapier init` command for Minimal and Typescript templates [PDE-5248] (#976)

* initial updates for init

* update smoke tests, add module option to env

* update test to include module flag

* update typescript init + tests

* add example apps

* add build.js test for typescript-esm example app

* update test required files number

* PR feedback - fix generator code, upgrade gulp-prettier, update eslint config

* update example apps

* update build ESM test to match typescript-esm template

* consolidate typescript templates, update generator, regenerate example-apps

* update shouldDeleteWrapper to default to true

* PDE-5248 test(cli): include ESM templates to smoke tests (#986)

* Include ESM templates to smoke tests

* Change example app title to 'minimal-esm'

* Better error message when zapierwrapper.mjs can't be found

---------

Co-authored-by: Chang-Hung Liang <chang-hung.liang@zapier.com>

* convert more functions to async/await

* fix localAppCommand logic

* fix failing tests - use local core for workspace tests, check for existing bundle for whatHappened

* remove promise file, clean up console logs, fix typos

* remove empty context, add default

* remove todo

* feat( schema ): update dynamic type to include functions and requests (#979)

* regenerate files

* swap search for dynamic

* BREAKING CHANGE(schema): Merge shouldLock deprecation into v17 release branch [PDE-5590] (#988)

* PDE-4241 Deprecate shouldLock

* PDE-4241 Update lock description

---------

Co-authored-by: kola-er <kola.erinoso@zapier.com>
Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>

* remove promise tests

* fix middleware to handle legacy scripting

* check the keys length not object length

* Rename InputFieldSchema to PlainInputField Schema

* Rename Ouput and (base) Field schemas with "Plain"

* Rename DynamicInputFields to InputFields

* Rename DynamicOutputFields to OutputFields

* Remove lockfile

* Create dedicated SeparateOperation Schema

This will help with downstream types later.

* Bump expected file number in tests for new schema

* Make CreateOperation name consistent with others

* PDE-5261 chore: native promise with updates from main branch (#997)

* Bump vite from 5.4.11 to 5.4.14

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.11 to 5.4.14.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.14/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.14/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump vitest from 1.6.0 to 1.6.1

Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v1.6.1/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump vitest from 1.6.0 to 1.6.1 in /schema-to-ts

Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v1.6.1/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* feat(cli): add --authentication-id flag to `invoke` subcommand

* WIP

* Add result to bundle.inputData

* spread keys to root obj

* Addition of OpenAI Example App

* Addition of OpenAI Template Generator

* If authId, don't warn about empty .env

* Update changelog

* Bump cli, core, schema 16.3.0 -> 16.3.1

* fix(cli): location of SyntaxError not showing even if --debug is on

* WIP

* Add middleware

* Remove --inspect and debugger

* invoke: Don't explode when .zapierapprc is missing

* Edit invoke command help

* [PDE-5913] fix(schema): Update schema doc url template to reference GitHub markdown (#984)

* fix schema doc url template

* fix test

* Auxiliary line removed.

---------

Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>

* Fix typo

* Add examples

* Load .env even in relay mode

* Object ID could be 0

* [PDE-5886] feat(cli): Add warning to `zapier deprecate` command (#985)

* updates to deprecate command

* support -f flag

* Update packages/cli/src/oclif/commands/deprecate.js

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Update packages/cli/src/oclif/commands/deprecate.js

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Update packages/cli/docs/cli.md

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

---------

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Add command to mark integration version as legacy

* Don't send authorization header in `zapier invoke` relay mode

* Improve invoke help doc

* use same language

* Update docs

* Link to a doc with the instructions on how to find auth IDs

* Add 16.4.0 changelog

* Bump cli, core, schema 16.3.1 -> 16.4.0

* update changelog

* return state instead of deployment

* Remove migration nudge on promote

* Add changelog

* Add spotlight msg

* Bump cli, core, schema 16.4.0 -> 16.5.0

* Fix `zapier invoke` in v17

* Fix bug where cli v17 doesn't work with core v16

* Resolve conflict in example app

* Remove reload from getLocalAppHandler, fix for Node.js 22

* Remove bluebird

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>
Co-authored-by: Stanley Chin <stan.chin@zapier.com>
Co-authored-by: Brody Berson <brody.berson@zapier.com>
Co-authored-by: Brody Berson <2766432+mynamebrody@users.noreply.github.com>
Co-authored-by: Raúl Negrón <rnegron@users.noreply.github.com>
Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>
Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>
Co-authored-by: Raúl Negrón <raul.negron@zapier.com>

* Don't replace everything in request object

* fix(core): PDE-6038 trim newline and whitespaces from request header (#1000)

* PDE-6038 add sanatize header middleware

* add file

* fix test

* address review comments

* add line back

* BREAKING CHANGE(core): Remove Bluebird, replace with native promises (#980)

* remove bluebird, replace with native promises

* add comments and initial whatHappened in middleware

* update middleware to remove .then

* add try/catch and enrich error message

* fix logging hang detection and error handling logic + tests

* convert more functions to async/await

* fix localAppCommand logic

* fix failing tests - use local core for workspace tests, check for existing bundle for whatHappened

* remove promise file, clean up console logs, fix typos

* remove empty context, add default

* remove todo

* remove promise tests

* fix middleware to handle legacy scripting

* check the keys length not object length

* PDE-5261 chore: native promise with updates from main branch (#997)

* Bump vite from 5.4.11 to 5.4.14

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.11 to 5.4.14.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.14/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.14/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump vitest from 1.6.0 to 1.6.1

Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v1.6.1/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump vitest from 1.6.0 to 1.6.1 in /schema-to-ts

Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v1.6.1/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* feat(cli): add --authentication-id flag to `invoke` subcommand

* WIP

* Add result to bundle.inputData

* spread keys to root obj

* Addition of OpenAI Example App

* Addition of OpenAI Template Generator

* If authId, don't warn about empty .env

* Update changelog

* Bump cli, core, schema 16.3.0 -> 16.3.1

* fix(cli): location of SyntaxError not showing even if --debug is on

* WIP

* Add middleware

* Remove --inspect and debugger

* invoke: Don't explode when .zapierapprc is missing

* Edit invoke command help

* [PDE-5913] fix(schema): Update schema doc url template to reference GitHub markdown (#984)

* fix schema doc url template

* fix test

* Auxiliary line removed.

---------

Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>

* Fix typo

* Add examples

* Load .env even in relay mode

* Object ID could be 0

* [PDE-5886] feat(cli): Add warning to `zapier deprecate` command (#985)

* updates to deprecate command

* support -f flag

* Update packages/cli/src/oclif/commands/deprecate.js

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Update packages/cli/src/oclif/commands/deprecate.js

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Update packages/cli/docs/cli.md

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

---------

Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>

* Add command to mark integration version as legacy

* Don't send authorization header in `zapier invoke` relay mode

* Improve invoke help doc

* use same language

* Update docs

* Link to a doc with the instructions on how to find auth IDs

* Add 16.4.0 changelog

* Bump cli, core, schema 16.3.1 -> 16.4.0

* update changelog

* return state instead of deployment

* Remove migration nudge on promote

* Add changelog

* Add spotlight msg

* Bump cli, core, schema 16.4.0 -> 16.5.0

* Fix `zapier invoke` in v17

* Fix bug where cli v17 doesn't work with core v16

* Resolve conflict in example app

* Remove reload from getLocalAppHandler, fix for Node.js 22

* Remove bluebird

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>
Co-authored-by: Stanley Chin <stan.chin@zapier.com>
Co-authored-by: Brody Berson <brody.berson@zapier.com>
Co-authored-by: Brody Berson <2766432+mynamebrody@users.noreply.github.com>
Co-authored-by: Raúl Negrón <rnegron@users.noreply.github.com>
Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>
Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>
Co-authored-by: Raúl Negrón <raul.negron@zapier.com>

* add uncaught + unhandled error test cases

* update type test file

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Chang-Hung Liang <chang-hung.liang@zapier.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>
Co-authored-by: Stanley Chin <stan.chin@zapier.com>
Co-authored-by: Brody Berson <brody.berson@zapier.com>
Co-authored-by: Brody Berson <2766432+mynamebrody@users.noreply.github.com>
Co-authored-by: Raúl Negrón <rnegron@users.noreply.github.com>
Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>
Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>
Co-authored-by: Raúl Negrón <raul.negron@zapier.com>

* Make z.request() throw for curlies by default

* legacy-scripting-runner still needs {{curlies}} replacement

* PDE-6051 add back integer type (#1002)

* add computed field back to input field schema (#1003)

* PDE-6065 add canPaginate to inputFields, add func-constraint as well (#1004)

* chore(schema): PDE-6090 revert dynamic dropdown (#1005)

* Revert dyanmic dropdown extenstion

* remove unused import

* update description

* Remove `zapier` prefix from type modules

* Bump schema-to-ts dependencies

* Switch compiled types to tsx, ~2x speedup

* Remove timestamps from schema compiler logs

* Rename main.ts to compiler.ts

Because that's what it really is

* Rename CLI to main

* Switch to @commander-js/extra-typings

* Fix more old module names

* Minor typing improvement

* Minor tweaks to imports and shebang

* Add inputs.d.ts, supporting Bundle shape inference

* First pass of different perform functions

* Simplify and make stricter schema-to-ts tsconfig

* schema-to-ts V2 experiment

* Improve schema-to-ts v2 interface generation

* Begin generalising rawType rendering

* Massively simplify schema-to-ts v2 again

* Add preamble to V2 output

* Add import handling

* Add middleware patching plugins

* Simply plugins, complete function types

* Ad string enum support

* Fix arrays of unions

* Initial Type Arg (generic) plugins

* Minor Docs improvements

* Use schema-to-ts plugins to split trigger types & add input generics

* Add HookToPoll function types

* Import perform function types to generated module

* Thread generics through Triggers, Creates, & Searches

* Introduce schema-to-ts v3, and remove v1 & v2

This takes many of the improvements made in the v2 schema-to-ts
compiler, and refactors them to a radically simpler yet again system.
The plugin system is gone, and a tree of "overrides" is now defined in
constants.ts that lets any type be patched with either a string
replacement, a partial set of options to give to apply to the ts-morph
call, or a function that can take full control of what gets rendered.

* Add crash for unused overrides, and add flag to ignore

* Update compiler for new & better schema names

* Integrate new schema types and upgrade tests

Still more to do, but making use of the changes from PR#998

* Support "ignore" symbols in schema-to-ts overrides

* Add $Key generics to T/C/S actions

* Experiment with define() helpers

* Type improvements, and add define helpers

* Narrow Bundle types to Record<string, unknown> by default

* Improve docs and imports for types

* Omit the Triggers, Creates, & Searches schemas that are unused

* Rename constants.ts to overrides.ts, for clarity

* Update schema-to-ts README with up-to-date info

* Restore main ZPC type tests (post-rebase conflicts)

* Remove pnpm lock

* Remove unused comments from perform function types

* Clarify nomenclature in inputs.d.ts

* All searches to return >1 item in array

* refactor to `defineInputFields` to improve consistency

* Add `defineSearch` helper functions

* Add singular `defineInputField` helper to ZPC

* Update yarn lockfile

* Fix define helper import tests

* Fix CreatePerform default type

* Fix TS build CLI tests

* Update TS templates with v17 TS patterns

* Update TS scaffold commands with v17 TS patterns

* chore(cli, schema, core): Update dependencies [PDE-5965] (#1010)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Natay Aberra <natay.aberra@gmail.com>
Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>
Co-authored-by: Kolawole Erinoso <kola.erinoso@gmail.com>
Co-authored-by: Raúl Negrón <rnegron@users.noreply.github.com>
Co-authored-by: Chang-Hung Liang <chang-hung.liang@zapier.com>
Co-authored-by: kola-er <kola.erinoso@zapier.com>
Co-authored-by: Thomas Cranny <thomas.cranny@zapier.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Stanley Chin <stan.chin@zapier.com>
Co-authored-by: Brody Berson <brody.berson@zapier.com>
Co-authored-by: Brody Berson <2766432+mynamebrody@users.noreply.github.com>
Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>
Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>
Co-authored-by: Raúl Negrón <raul.negron@zapier.com>

* Bump cli, core, schema 16.5.1 -> 17.0.0

* generated schemas

* Bump legacy-scripting-runner 3.8.14 -> 3.8.15

* revert legacy scripting runner update

* update workspace test to use npmPackCore

* legacy scripting runner changelog and version bump

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Natay Aberra <natay.aberra@gmail.com>
Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>
Co-authored-by: Kolawole Erinoso <kola.erinoso@gmail.com>
Co-authored-by: Raúl Negrón <rnegron@users.noreply.github.com>
Co-authored-by: Chang-Hung Liang <chang-hung.liang@zapier.com>
Co-authored-by: kola-er <kola.erinoso@zapier.com>
Co-authored-by: Thomas Cranny <thomas.cranny@zapier.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Stanley Chin <stan.chin@zapier.com>
Co-authored-by: Brody Berson <brody.berson@zapier.com>
Co-authored-by: Brody Berson <2766432+mynamebrody@users.noreply.github.com>
Co-authored-by: szchenghuang <6309412+szchenghuang@users.noreply.github.com>
Co-authored-by: Fokke Zandbergen <fokke.zandbergen@zapier.com>
Co-authored-by: Raúl Negrón <raul.negron@zapier.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants