@flink-app/apn-plugin 2.0.0-alpha.56 → 2.0.0-alpha.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.flink/generatedAgents.ts +1 -1
- package/.flink/generatedHandlers.ts +1 -1
- package/.flink/generatedJobs.ts +1 -1
- package/.flink/generatedRepos.ts +1 -1
- package/.flink/generatedTools.ts +1 -1
- package/.flink/start.ts +1 -1
- package/CHANGELOG.md +23 -0
- package/dist/.flink/generatedAgents.js +13 -6
- package/dist/.flink/generatedAgents.js.map +1 -0
- package/dist/.flink/generatedHandlers.js +13 -6
- package/dist/.flink/generatedHandlers.js.map +1 -0
- package/dist/.flink/generatedJobs.js +13 -6
- package/dist/.flink/generatedJobs.js.map +1 -0
- package/dist/.flink/generatedRepos.js +13 -6
- package/dist/.flink/generatedRepos.js.map +1 -0
- package/dist/.flink/generatedTools.js +13 -6
- package/dist/.flink/generatedTools.js.map +1 -0
- package/dist/.flink/schema-manifest.json +44 -0
- package/dist/.flink/schemas/schemas.js +1 -1
- package/dist/.flink/start.js +12 -3
- package/dist/.flink/start.js.map +1 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/src/ApnPluginContext.js +3 -1
- package/dist/src/ApnPluginContext.js.map +1 -0
- package/dist/src/apnPlugin.js +57 -94
- package/dist/src/apnPlugin.js.map +1 -0
- package/dist/src/index.js +18 -17
- package/dist/src/index.js.map +1 -0
- package/dist/src/schemas/ApnMessage.js +3 -1
- package/dist/src/schemas/ApnMessage.js.map +1 -0
- package/package.json +3 -3
- package/.flink/schemas/schemas.ts +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated
|
|
1
|
+
// Generated Sat Feb 28 2026 14:03:15 GMT+0100 (Central European Standard Time)
|
|
2
2
|
import { autoRegisteredAgents } from "@flink-app/flink";
|
|
3
3
|
export const agents = [];
|
|
4
4
|
autoRegisteredAgents.push(...agents);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated
|
|
1
|
+
// Generated Sat Feb 28 2026 14:03:15 GMT+0100 (Central European Standard Time)
|
|
2
2
|
import { autoRegisteredHandlers, HttpMethod } from "@flink-app/flink";
|
|
3
3
|
export const handlers = [];
|
|
4
4
|
autoRegisteredHandlers.push(...handlers);
|
package/.flink/generatedJobs.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated
|
|
1
|
+
// Generated Sat Feb 28 2026 14:03:15 GMT+0100 (Central European Standard Time)
|
|
2
2
|
import { autoRegisteredJobs } from "@flink-app/flink";
|
|
3
3
|
export const jobs = [];
|
|
4
4
|
autoRegisteredJobs.push(...jobs);
|
package/.flink/generatedRepos.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated
|
|
1
|
+
// Generated Sat Feb 28 2026 14:03:15 GMT+0100 (Central European Standard Time)
|
|
2
2
|
import { autoRegisteredRepos } from "@flink-app/flink";
|
|
3
3
|
export const repos = [];
|
|
4
4
|
autoRegisteredRepos.push(...repos);
|
package/.flink/generatedTools.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated
|
|
1
|
+
// Generated Sat Feb 28 2026 14:03:15 GMT+0100 (Central European Standard Time)
|
|
2
2
|
import { autoRegisteredTools } from "@flink-app/flink";
|
|
3
3
|
export const tools = [];
|
|
4
4
|
autoRegisteredTools.push(...tools);
|
package/.flink/start.ts
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @flink-app/apn-plugin
|
|
2
2
|
|
|
3
|
+
## 2.0.0-alpha.58
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @flink-app/flink@2.0.0-alpha.58
|
|
9
|
+
|
|
10
|
+
## 2.0.0-alpha.57
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [ef7f495]
|
|
15
|
+
- Updated dependencies [2d53aa4]
|
|
16
|
+
- Updated dependencies [b3cc5d1]
|
|
17
|
+
- Updated dependencies [d377fac]
|
|
18
|
+
- Updated dependencies [4ad44c0]
|
|
19
|
+
- Updated dependencies [90f80c7]
|
|
20
|
+
- Updated dependencies [f0887e7]
|
|
21
|
+
- Updated dependencies [68c46d3]
|
|
22
|
+
- Updated dependencies [4ad44c0]
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
- @flink-app/flink@2.0.0-alpha.57
|
|
25
|
+
|
|
3
26
|
## 2.0.0-alpha.56
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
// Generated Sat Feb 28 2026 14:03:15 GMT+0100 (Central European Standard Time)
|
|
1
2
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "agents", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function() {
|
|
9
|
+
return agents;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
const _flink = require("@flink-app/flink");
|
|
13
|
+
const agents = [];
|
|
14
|
+
_flink.autoRegisteredAgents.push(...agents);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/joel/projects/flink/flink-framework/packages/apn-plugin/.flink/generatedAgents.ts"],"sourcesContent":["// Generated Sat Feb 28 2026 14:03:15 GMT+0100 (Central European Standard Time)\nimport { autoRegisteredAgents } from \"@flink-app/flink\";\nexport const agents = [];\nautoRegisteredAgents.push(...agents);\n "],"names":["agents","autoRegisteredAgents","push"],"mappings":"AAAA,+EAA+E;;;;;+BAElEA;;;eAAAA;;;uBADwB;AAC9B,MAAMA,SAAS,EAAE;AACxBC,2BAAoB,CAACC,IAAI,IAAIF"}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
// Generated Sat Feb 28 2026 14:03:15 GMT+0100 (Central European Standard Time)
|
|
1
2
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "handlers", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function() {
|
|
9
|
+
return handlers;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
const _flink = require("@flink-app/flink");
|
|
13
|
+
const handlers = [];
|
|
14
|
+
_flink.autoRegisteredHandlers.push(...handlers);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/joel/projects/flink/flink-framework/packages/apn-plugin/.flink/generatedHandlers.ts"],"sourcesContent":["// Generated Sat Feb 28 2026 14:03:15 GMT+0100 (Central European Standard Time)\nimport { autoRegisteredHandlers, HttpMethod } from \"@flink-app/flink\";\nexport const handlers = [];\nautoRegisteredHandlers.push(...handlers);\n "],"names":["handlers","autoRegisteredHandlers","push"],"mappings":"AAAA,+EAA+E;;;;;+BAElEA;;;eAAAA;;;uBADsC;AAC5C,MAAMA,WAAW,EAAE;AAC1BC,6BAAsB,CAACC,IAAI,IAAIF"}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
// Generated Sat Feb 28 2026 14:03:15 GMT+0100 (Central European Standard Time)
|
|
1
2
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "jobs", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function() {
|
|
9
|
+
return jobs;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
const _flink = require("@flink-app/flink");
|
|
13
|
+
const jobs = [];
|
|
14
|
+
_flink.autoRegisteredJobs.push(...jobs);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/joel/projects/flink/flink-framework/packages/apn-plugin/.flink/generatedJobs.ts"],"sourcesContent":["// Generated Sat Feb 28 2026 14:03:15 GMT+0100 (Central European Standard Time)\nimport { autoRegisteredJobs } from \"@flink-app/flink\";\nexport const jobs = [];\nautoRegisteredJobs.push(...jobs);\n "],"names":["jobs","autoRegisteredJobs","push"],"mappings":"AAAA,+EAA+E;;;;;+BAElEA;;;eAAAA;;;uBADsB;AAC5B,MAAMA,OAAO,EAAE;AACtBC,yBAAkB,CAACC,IAAI,IAAIF"}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
// Generated Sat Feb 28 2026 14:03:15 GMT+0100 (Central European Standard Time)
|
|
1
2
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "repos", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function() {
|
|
9
|
+
return repos;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
const _flink = require("@flink-app/flink");
|
|
13
|
+
const repos = [];
|
|
14
|
+
_flink.autoRegisteredRepos.push(...repos);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/joel/projects/flink/flink-framework/packages/apn-plugin/.flink/generatedRepos.ts"],"sourcesContent":["// Generated Sat Feb 28 2026 14:03:15 GMT+0100 (Central European Standard Time)\n import { autoRegisteredRepos } from \"@flink-app/flink\";\n export const repos = [];\n autoRegisteredRepos.push(...repos);\n "],"names":["repos","autoRegisteredRepos","push"],"mappings":"AAAA,+EAA+E;;;;;+BAEhEA;;;eAAAA;;;uBADuB;AAC7B,MAAMA,QAAQ,EAAE;AACvBC,0BAAmB,CAACC,IAAI,IAAIF"}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
// Generated Sat Feb 28 2026 14:03:15 GMT+0100 (Central European Standard Time)
|
|
1
2
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "tools", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function() {
|
|
9
|
+
return tools;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
const _flink = require("@flink-app/flink");
|
|
13
|
+
const tools = [];
|
|
14
|
+
_flink.autoRegisteredTools.push(...tools);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/joel/projects/flink/flink-framework/packages/apn-plugin/.flink/generatedTools.ts"],"sourcesContent":["// Generated Sat Feb 28 2026 14:03:15 GMT+0100 (Central European Standard Time)\nimport { autoRegisteredTools } from \"@flink-app/flink\";\nexport const tools = [];\nautoRegisteredTools.push(...tools);\n "],"names":["tools","autoRegisteredTools","push"],"mappings":"AAAA,+EAA+E;;;;;+BAElEA;;;eAAAA;;;uBADuB;AAC7B,MAAMA,QAAQ,EAAE;AACvBC,0BAAmB,CAACC,IAAI,IAAIF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2.0",
|
|
3
|
+
"generated": "2026-02-28T13:03:15.900Z",
|
|
4
|
+
"schemas": {
|
|
5
|
+
"ApnMessage": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"to": {
|
|
9
|
+
"type": "array",
|
|
10
|
+
"items": {
|
|
11
|
+
"type": "string"
|
|
12
|
+
},
|
|
13
|
+
"description": "Devices to send to"
|
|
14
|
+
},
|
|
15
|
+
"alert": {
|
|
16
|
+
"type": "string"
|
|
17
|
+
},
|
|
18
|
+
"payload": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"additionalProperties": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"topic": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"pushType": {
|
|
28
|
+
"$ref": "#/$defs/NotificationPushType"
|
|
29
|
+
},
|
|
30
|
+
"priority": {
|
|
31
|
+
"type": "number"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"required": [
|
|
35
|
+
"to",
|
|
36
|
+
"payload"
|
|
37
|
+
],
|
|
38
|
+
"$id": "ApnMessage",
|
|
39
|
+
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"handlers": {},
|
|
43
|
+
"tools": {}
|
|
44
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Generated Sun Feb 15 2026
|
|
2
|
+
// Generated Sun Feb 15 2026 15:25:14 GMT+0100 (Central European Standard Time)
|
package/dist/.flink/start.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
// Generated Sat Feb 28 2026 14:03:15 GMT+0100 (Central European Standard Time)
|
|
1
2
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default" // Export an empty object to make it a module
|
|
7
|
+
, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function() {
|
|
10
|
+
return _default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
4
13
|
require("./generatedHandlers");
|
|
5
14
|
require("./generatedRepos");
|
|
6
15
|
require("./generatedTools");
|
|
7
16
|
require("./generatedAgents");
|
|
8
17
|
require("./generatedJobs");
|
|
9
18
|
require("../src/index");
|
|
10
|
-
|
|
19
|
+
const _default = {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/joel/projects/flink/flink-framework/packages/apn-plugin/.flink/start.ts"],"sourcesContent":["// Generated Sat Feb 28 2026 14:03:15 GMT+0100 (Central European Standard Time)\nimport \"./generatedHandlers\";\nimport \"./generatedRepos\";\nimport \"./generatedTools\";\nimport \"./generatedAgents\";\nimport \"./generatedJobs\";\nimport \"../src/index\";\nexport default {}; // Export an empty object to make it a module\n"],"names":[],"mappings":"AAAA,+EAA+E;;;;;+BAO/E,UAAmB,6CAA6C;;;;eAAhE;;;QANO;QACA;QACA;QACA;QACA;QACA;MACP,WAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":"5.6.2"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/src/apnPlugin.js
CHANGED
|
@@ -1,57 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "apnPlugin", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return apnPlugin;
|
|
36
9
|
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
10
|
+
});
|
|
11
|
+
const _flink = require("@flink-app/flink");
|
|
12
|
+
const _nodeapn = /*#__PURE__*/ _interop_require_default(require("@parse/node-apn"));
|
|
13
|
+
function _interop_require_default(obj) {
|
|
14
|
+
return obj && obj.__esModule ? obj : {
|
|
15
|
+
default: obj
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const apnPlugin = (options)=>{
|
|
46
19
|
// Decode the base64 encoded certificate and key.
|
|
47
|
-
|
|
48
|
-
|
|
20
|
+
const decodedCert = Buffer.from(options.certificate.cert, "base64");
|
|
21
|
+
const decodedKey = Buffer.from(options.certificate.key, "base64");
|
|
49
22
|
// Initialize the APNs provider using certificate-based authentication.
|
|
50
|
-
|
|
23
|
+
const provider = new _nodeapn.default.Provider({
|
|
51
24
|
cert: decodedCert,
|
|
52
25
|
key: decodedKey,
|
|
53
26
|
passphrase: options.certificate.passphrase,
|
|
54
|
-
production: options.production
|
|
27
|
+
production: options.production
|
|
55
28
|
});
|
|
56
29
|
return {
|
|
57
30
|
id: "apn",
|
|
@@ -63,53 +36,43 @@ var apnPlugin = function (options) {
|
|
|
63
36
|
* - `alert`: (optional) text to display,
|
|
64
37
|
* - `payload`: (optional) any extra data,
|
|
65
38
|
* - `topic`: (optional) override the default APNs topic.
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
case 2:
|
|
96
|
-
result = _a.sent();
|
|
97
|
-
flink_1.log.debug("[apn] APNs push result:", JSON.stringify(result));
|
|
98
|
-
return [2 /*return*/, result];
|
|
99
|
-
case 3:
|
|
100
|
-
err_1 = _a.sent();
|
|
101
|
-
console.error("Error sending APNs push:", err_1);
|
|
102
|
-
throw err_1;
|
|
103
|
-
case 4: return [2 /*return*/];
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}); },
|
|
39
|
+
*/ send: async (message)=>{
|
|
40
|
+
if (!message.to || message.to.length === 0) {
|
|
41
|
+
throw new Error("No device tokens provided in message.to");
|
|
42
|
+
}
|
|
43
|
+
const notification = new _nodeapn.default.Notification();
|
|
44
|
+
notification.pushType = message.pushType || "alert";
|
|
45
|
+
// Set the priority to the default or the provided value.
|
|
46
|
+
notification.priority = message.priority || options.defaultPriority || 10;
|
|
47
|
+
// Use the topic provided in the message or fall back to the plugin's default.
|
|
48
|
+
notification.topic = message.topic || options.topic;
|
|
49
|
+
if (!notification.topic) {
|
|
50
|
+
throw new Error("APNs topic must be provided either in the message or in plugin options");
|
|
51
|
+
}
|
|
52
|
+
// Set any provided alert and payload properties.
|
|
53
|
+
if (message.alert) {
|
|
54
|
+
notification.alert = message.alert;
|
|
55
|
+
}
|
|
56
|
+
if (message.payload) {
|
|
57
|
+
notification.payload = message.payload;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
const result = await provider.send(notification, message.to);
|
|
61
|
+
_flink.log.debug("[apn] APNs push result:", JSON.stringify(result));
|
|
62
|
+
return result;
|
|
63
|
+
} catch (err) {
|
|
64
|
+
console.error("Error sending APNs push:", err);
|
|
65
|
+
throw err;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
107
68
|
},
|
|
108
|
-
init:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
69
|
+
init: async (app)=>{
|
|
70
|
+
// Optionally, add a message handler to your framework.
|
|
71
|
+
// Adjust permissions or handler names as required by your app.
|
|
72
|
+
// Example:
|
|
73
|
+
// app.addHandler("PostMessage", {
|
|
74
|
+
// permissions: [options.permissions?.send || "apn:send"],
|
|
75
|
+
// });
|
|
76
|
+
}
|
|
113
77
|
};
|
|
114
78
|
};
|
|
115
|
-
exports.apnPlugin = apnPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/joel/projects/flink/flink-framework/packages/apn-plugin/src/apnPlugin.ts"],"sourcesContent":["import { FlinkPlugin, log } from \"@flink-app/flink\";\nimport apn from \"@parse/node-apn\";\n\nimport ApnMessage from \"./schemas/ApnMessage\";\n\nexport type ApnPluginOptions = {\n certificate: {\n /**\n * Base64 encoded string for your APNs certificate (in PEM format).\n */\n cert: string;\n /**\n * Base64 encoded string for your APNs private key (in PEM format).\n */\n key: string;\n /**\n * Optional passphrase for the private key, if needed.\n */\n passphrase?: string;\n };\n production: boolean;\n /**\n * Default topic for your APNs notifications.\n * For VoIP pushes this is typically your app's bundle id with a `.voip` suffix,\n * e.g. \"com.example.myapp.voip\".\n */\n topic: string;\n /**\n * Default priority for your APNs notifications.\n */\n defaultPriority?: number;\n};\n\nexport const apnPlugin = (options: ApnPluginOptions): FlinkPlugin => {\n // Decode the base64 encoded certificate and key.\n const decodedCert = Buffer.from(options.certificate.cert, \"base64\");\n const decodedKey = Buffer.from(options.certificate.key, \"base64\");\n\n // Initialize the APNs provider using certificate-based authentication.\n const provider = new apn.Provider({\n cert: decodedCert,\n key: decodedKey,\n passphrase: options.certificate.passphrase,\n production: options.production,\n });\n\n return {\n id: \"apn\",\n ctx: {\n /**\n * Sends a VoIP push notification.\n * @param message - The message to be sent. Expected to include:\n * - `to`: an array of device tokens,\n * - `alert`: (optional) text to display,\n * - `payload`: (optional) any extra data,\n * - `topic`: (optional) override the default APNs topic.\n */\n send: async (message: ApnMessage) => {\n if (!message.to || message.to.length === 0) {\n throw new Error(\"No device tokens provided in message.to\");\n }\n\n const notification = new apn.Notification();\n\n notification.pushType = message.pushType || \"alert\";\n\n // Set the priority to the default or the provided value.\n notification.priority = message.priority || options.defaultPriority || 10;\n\n // Use the topic provided in the message or fall back to the plugin's default.\n notification.topic = message.topic || options.topic;\n if (!notification.topic) {\n throw new Error(\"APNs topic must be provided either in the message or in plugin options\");\n }\n\n // Set any provided alert and payload properties.\n if (message.alert) {\n notification.alert = message.alert;\n }\n if (message.payload) {\n notification.payload = message.payload;\n }\n\n try {\n const result = await provider.send(notification, message.to);\n log.debug(\"[apn] APNs push result:\", JSON.stringify(result));\n return result;\n } catch (err) {\n console.error(\"Error sending APNs push:\", err);\n throw err;\n }\n },\n },\n init: async (app) => {\n // Optionally, add a message handler to your framework.\n // Adjust permissions or handler names as required by your app.\n // Example:\n // app.addHandler(\"PostMessage\", {\n // permissions: [options.permissions?.send || \"apn:send\"],\n // });\n },\n };\n};\n"],"names":["apnPlugin","options","decodedCert","Buffer","from","certificate","cert","decodedKey","key","provider","apn","Provider","passphrase","production","id","ctx","send","message","to","length","Error","notification","Notification","pushType","priority","defaultPriority","topic","alert","payload","result","log","debug","JSON","stringify","err","console","error","init","app"],"mappings":";;;;+BAiCaA;;;eAAAA;;;uBAjCoB;gEACjB;;;;;;AAgCT,MAAMA,YAAY,CAACC;IACtB,iDAAiD;IACjD,MAAMC,cAAcC,OAAOC,IAAI,CAACH,QAAQI,WAAW,CAACC,IAAI,EAAE;IAC1D,MAAMC,aAAaJ,OAAOC,IAAI,CAACH,QAAQI,WAAW,CAACG,GAAG,EAAE;IAExD,uEAAuE;IACvE,MAAMC,WAAW,IAAIC,gBAAG,CAACC,QAAQ,CAAC;QAC9BL,MAAMJ;QACNM,KAAKD;QACLK,YAAYX,QAAQI,WAAW,CAACO,UAAU;QAC1CC,YAAYZ,QAAQY,UAAU;IAClC;IAEA,OAAO;QACHC,IAAI;QACJC,KAAK;YACD;;;;;;;aAOC,GACDC,MAAM,OAAOC;gBACT,IAAI,CAACA,QAAQC,EAAE,IAAID,QAAQC,EAAE,CAACC,MAAM,KAAK,GAAG;oBACxC,MAAM,IAAIC,MAAM;gBACpB;gBAEA,MAAMC,eAAe,IAAIX,gBAAG,CAACY,YAAY;gBAEzCD,aAAaE,QAAQ,GAAGN,QAAQM,QAAQ,IAAI;gBAE5C,yDAAyD;gBACzDF,aAAaG,QAAQ,GAAGP,QAAQO,QAAQ,IAAIvB,QAAQwB,eAAe,IAAI;gBAEvE,8EAA8E;gBAC9EJ,aAAaK,KAAK,GAAGT,QAAQS,KAAK,IAAIzB,QAAQyB,KAAK;gBACnD,IAAI,CAACL,aAAaK,KAAK,EAAE;oBACrB,MAAM,IAAIN,MAAM;gBACpB;gBAEA,iDAAiD;gBACjD,IAAIH,QAAQU,KAAK,EAAE;oBACfN,aAAaM,KAAK,GAAGV,QAAQU,KAAK;gBACtC;gBACA,IAAIV,QAAQW,OAAO,EAAE;oBACjBP,aAAaO,OAAO,GAAGX,QAAQW,OAAO;gBAC1C;gBAEA,IAAI;oBACA,MAAMC,SAAS,MAAMpB,SAASO,IAAI,CAACK,cAAcJ,QAAQC,EAAE;oBAC3DY,UAAG,CAACC,KAAK,CAAC,2BAA2BC,KAAKC,SAAS,CAACJ;oBACpD,OAAOA;gBACX,EAAE,OAAOK,KAAK;oBACVC,QAAQC,KAAK,CAAC,4BAA4BF;oBAC1C,MAAMA;gBACV;YACJ;QACJ;QACAG,MAAM,OAAOC;QACT,uDAAuD;QACvD,+DAA+D;QAC/D,WAAW;QACX,kCAAkC;QAClC,4DAA4D;QAC5D,MAAM;QACV;IACJ;AACJ"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./apnPlugin"), exports);
|
|
6
|
+
_export_star(require("./ApnPluginContext"), exports);
|
|
7
|
+
function _export_star(from, to) {
|
|
8
|
+
Object.keys(from).forEach(function(k) {
|
|
9
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
10
|
+
Object.defineProperty(to, k, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function() {
|
|
13
|
+
return from[k];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return from;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/joel/projects/flink/flink-framework/packages/apn-plugin/src/index.ts"],"sourcesContent":["export * from \"./apnPlugin\";\nexport * from \"./ApnPluginContext\";\n"],"names":[],"mappings":";;;;qBAAc;qBACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flink-app/apn-plugin",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.58",
|
|
4
4
|
"description": "Flink plugin to send push notifications to APN",
|
|
5
5
|
"author": "joel@frost.se",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/node": "22.13.10",
|
|
17
|
-
"@flink-app/flink": "2.0.0-alpha.
|
|
17
|
+
"@flink-app/flink": "2.0.0-alpha.58"
|
|
18
18
|
},
|
|
19
19
|
"gitHead": "4243e3b3cd6d4e1ca001a61baa8436bf2bbe4113",
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@flink-app/flink": ">=2.0.0-alpha.
|
|
21
|
+
"@flink-app/flink": ">=2.0.0-alpha.58"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"test": "echo \"Error: no test specified\"",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// Generated Sun Feb 15 2026 09:57:23 GMT+0100 (Central European Standard Time)
|